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
Gabriel Meneses 10Gabriel Meneses 10 

custom button apex code

 I want to create a custom button in my opportunity object that can do very specific tasks. It needs to delete the opportunity clone, uncheck the Opportunity rolled checkbox and change the stage from closed to actively selling. Any ideas on where to start with this one?
ManojjenaManojjena
Hi  Gabriel Meneses 10

 What exactly delete the opportunity clone means can you explain this so that we can help you .
Thanks 
Manoj
Shruti SShruti S

+1
Also, what is the order of the actions in the list of tasks that you specified?

Gabriel Meneses 10Gabriel Meneses 10
@Manojjena, in my instance we clone our opportunities once they are closed won or close lost in order to use the data for the next step in that opportunity. @Shruti S, The order would need to be as follows: Delete the Opportunity Clone, Uncheck the Opportunity Rolled checkbox, and finally Change the Stage to Actively Selling. 
Shruti SShruti S
What if the Opportunity has related records like Products? While cloning, is it required to clone the related records also?
Gabriel Meneses 10Gabriel Meneses 10
@Shruti S, yes it would clone all perdinent and designated data, it does so now. But, once we follow those steps and change the Stage to Actively Selling, we will create an Email Template for that Opp owner that would state that they need to check the products and quantities to ensure proper reporting once the opp has be reopened.