function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Devaraj 7Devaraj 7 

i have account when i want click button that account details moved to another account and previous account will be deleted how it is possible

originalangoriginalang
You can also do this using Flows and a custom Button.  The flow must contain the following elements:
  • A variable that will store the initial record ID
  • An object variable that will hold the field information for the initial record.
  • A lookup element that finds the initial record and assigns it to the object variable.
  • A 'record create' element that creates a new Account record and lets you map the values from the object variable to the new record fields.
  • A 'record delete' element that deletes the initial record based on the ID variable
Finally, when you are satisfied with the flow, you can create a button on the Account object that references this flow through it's. You can also pass the Account ID in the url, and assign it to the ID variable that you created. A guide to doing this can be found here: https://help.salesforce.com/articleView?id=vpm_url_set_variable.htm&type=5

This method may be easier than implementing the process with Apex and Visualforce, however, it is completely possible to perform the same function with Apex. Please let me know if it is absolutely necessary to do so.