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