public with sharing class SaveAssetFromReportController { public String newId { get; private set; } public void init() { String eid = ApexPages.currentPage().getParameters().get('eid'); newId = ApexPages.currentPage().getParameters().get('newid'); Event__c e = [select Id, Asset_Manual_Count__c from Event__c where Id = :eid]; e.Asset_Manual_ID__c = newId; if (e.Asset_Manual_Count__c == null) { e.Asset_Manual_Count__c = 1; } else { e.Asset_Manual_Count__c = e.Asset_Manual_Count__c + 1; } update e; } }