You need to sign in to do that
Don't have an account?
Arpit Jain92
Clone records after click on custom button on vf
Hi,
I am creating a vf page on which i need to show account,opportunity and opportunity contact role with a checkbox and a custom button(Clone). I need to clone all the selected records after click on this button.
I am new to Salesforce and have worked on this functionality for a long time. I would really appreciate your help on this functionaly.
I am creating a vf page on which i need to show account,opportunity and opportunity contact role with a checkbox and a custom button(Clone). I need to clone all the selected records after click on this button.
I am new to Salesforce and have worked on this functionality for a long time. I would really appreciate your help on this functionaly.
Try usign this, it will help you in making your code less complex and also reduce the number of lines of codes.
Reference :
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm
All Answers
This cloning functionality can be achieved by writing a javascript for this custom button.
As an example lets create a custom button "Clone" that will clone the record.
Simply override your custom button "Clone" with the following java script and you will have your custom Clone button that functions exactly like standard clone button.
On cliking on your checkbox get your record id.Put your id in the js code.
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
window.parent.location.href="/{!recordId}/e?&clone=1&retURL=/{!Account.Id}";
retUrl specifies the location where you want to be on press of back button.
Thanks
Ashoka
Thank You.
But I need to do this using wrapper class. Could you please tell me how to resolve this via wrapper.
Ragrds,
Arpit
Try usign this, it will help you in making your code less complex and also reduce the number of lines of codes.
Reference :
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm