0

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. enter image description here

1
  • What have you tried. Where are you having trouble. You will get a lot more responses if you do some effort yourself. This is not a site for free development
    – Eric
    Dec 4, 2014 at 5:26

1 Answer 1

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .