I have a object called the Commercial and i have use the standard edit button to rendered into my Commercial Edit VF page. Now i want to use the clone button but it should not work like edit button. Clone as if means to start the new commercial VF page and work like a new button. Also Provide me the Apex code for the same .Thanks in Advance.
1 Answer
In Apex a record can be cloned as follows
customObject__c newRecord = existingRecord.clone(false,true);
newRecord .status__c = 'New'; //optionally, change any field that you want to be updated in cloned record.
insert newRecord;
For more details on the parameters of the clone method, refer the below link. http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_sobject.htm#apex_System_SObject_clone