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
Ajay Kumar 583Ajay Kumar 583 

How to change the Opp stage ??

Hi
I need to Change the Opportunity Stage to “Prospecting” whenever Opportunity Amount is changes to any value.

Thanks,
Aj
Best Answer chosen by Ajay Kumar 583
Ajay K DubediAjay K Dubedi
Hi Ajay Kumar,

You can use the below code:

<<<<----Trigger --->>>>>

trigger HandlerTriggerOpportunity on Opportunity (before Update) {
    for(Opportunity opp : Trigger.new){
        if(opp.Amount != Trigger.oldMap.get(opp.Id).Amount){
            opp.StageName = 'Prospecting';
        }
    }
    

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks,
Ajay Dubedi