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
RayAllenRayAllen 

How to create a duplicate opportunity from previous when the opp stage is equal to a certain stage

Hello,

 

I want to create a duplicate opportunity, for example, if opportunity stage is equal to “won” , I want it to be able to create an exact replica of the old opportunity.  I know I’ll have to make a workflow and use apex code.

 

How can I write the formula for this?

RayAllenRayAllen

Also, I would want it to be fully automated.

Rahul_sgRahul_sg

you will have to add apex trigger for this and in the trigger you can check the status change and then add a new opportunity record .

Subhani PSubhani P

Hi 

 

I hope that you can write an apex class and create a button to execute the work flow for duplicate Opportunity. Please refer the following which has the same example as yours.

 

http://christopheralunlewis.blogspot.in/2011/05/how-to-dynamically-clone-salesforce.html

 

http://stackoverflow.com/questions/9289005/clone-an-opportunity-and-its-lineitems-programatically-in-salesforce

 

Thanks & Regards,

Subhani.

DBSync,

www.mydbsync.com