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
santhosh  konsanthosh kon 

While creating a new record in opportunity I want to display opportunity stage as closed won using a Trigger?plz send some sample code?

Dushyant SonwarDushyant Sonwar
Hey santhosh,

You can try this sample code to assign  stagename as closed won through trigger
trigger UpdateStage on Opportunity (before insert) {
    for(Opportunity Opp:Trigger.new){
        Opp.stageName='closed won';
    }
}