Apex class to save custom object data
Save Lead with custom fields:
public PageReference saveLeadData() { Lead l = new Lead( P_PERSONID__c = 6663649, ROLEID__c = 5898589, P_PROJECTID__c = 10796447, Salutation = 'Mr.', FirstName = 'saket', LastName = 'saraf', Title = '', Phone = '98920000', Email = 'saket.saraf@gmail.com', Street = 'Land Adj 23 Lisle Street', City = 'Loughborough', State = 'Leicestershire', PostalCode = 'LE11 1AW', Fax = '', WebSite = '', LeadSource = 'Reserved' ); try { insert l; // inserts the new record into the database } catch (Exception e) { ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error, 'Error adding Reserve List.')); return null; //Use Page.newPagename } return null; //Use Page.newPagename }
Happy Coding……..
Total Page Visits: 6460 - Today Page Visits: 15