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
Daniel SeltzerDaniel Seltzer 

Set a Default Value For Opportunity Stage

Hi,

I would like to have all new Opportunities start with a default stage value of Stage 1: Initial Interest. I tried a WF rule but was unsuccessful. (below)

I think the best way to do this is with a trigger but i cannot find how to setup a trigger to insert a default value when the opp is created.

Please Help!!



User-added image



 
Phil WeinmeisterPhil Weinmeister
Hi Daniel,

You could create a custom Create button and append "&opp11=<default_value>" to the New Opp URL and replace the standard New button with your new create button.

The URL would be something like this: /006/e?retURL=%2F006%2Fo&opp11=Qualification (assuming that the value is Qualification).

Let me know if you need more info.

Thanks,
Phil
Hengky IlawanHengky Ilawan
Hi Daniel,

Try changing the rule criteria to use a Formula instead, and just fill in "TRUE" for the formula. Then change the workflow evaluation criteria to "Evaluate the rule when a record is created".

Regards,
Hengky
MithunPMithunP
Hi Daniel,

Below is the trigger, you can setup opportunity stage here
trigger OpportunityTrigger on Opportunity (before insert) {
     for(Opportunity opp: trigger.new){
           //You can setup stage name here
           opp.stagename = 'Initial Interest';
     }
}

Best Regards,
Mithun.
Daniel SeltzerDaniel Seltzer
The validation rule did not work.

The trigger also appeared to do nothing:( I know the button wil work but then I have to replace all buttons that create opportunities and the clone button. 

Any more suggestions. I feel like the trigger is the way to go but I need the new record to start with Stage Name "Initial Interest"

Here was the trigger I used:


trigger OpportunityTrigger on Opportunity (before insert) {
     for(Opportunity opp: trigger.new){
           opp.stagename = 'Initial Interest';
     }
}

Thanks for your help.
Hengky IlawanHengky Ilawan
Hi Daniel,

I have tried your initial approach (using workflow and field update). It is working well.

My config is:
- Workflow Evaluation Criteria: Created
- Rule Criteria: Formula evaluates to true
- The formula: TRUE

Regards,
Hengky
Daniel SeltzerDaniel Seltzer
Thanks Hengky,

Have you tried it with this specific case? I think the stage field will not allow a default value. Below is my WF that is still not working.

User-added image
Hengky IlawanHengky Ilawan
Yes, I tried with the same case. Your workflow looks OK.
What's your field update action like?
 
Daniel SeltzerDaniel Seltzer
Still no luck.

User-added image
Mohammad AzamMohammad Azam
U can achieve this via workflow on Opportunity

Steps follows
1.Create workflow.
2.select Opportunity Object. Click Next
.User-added image
3.a.Give Rule Name
   b.Evaluation Criteria - Created
   c.Rule Criteria - Criteria are met
   d.Field(Opportunity:Created Date) - Operator (Not Equal To) - Value (   ) keep the value blank/empty. Click Save & Next
User-added image
4.in Immediate Workflow Actions section. Click on Add workflow Action. Select Field Update.
5.a.Fill Name Field.
   b.Field to update - Select  Opportunity < (first Dropdown). Select- Stage < (Second Dropdown)> 
   c.In Section "Specify New Field Value" - Under "Picklist Options" - Select "A specific value Checkbox" and select ur Stage 1 Name from the drop down. Click Save and Activate the workflow.
User-added image
Now whenever opportunity is created, the default stage is your First Stage which u had selected.

Enjoy 
 
SherrieSherrie
The last solution worked for me, except in the case that someone creates an opportunity upon Lead Conversion. Then, it defaults back to the first Stage on the list of Stages as they are sorted, then immediately switches it the new one I specified in the workflow rule. The only problem with that is, it kicks off an email when the first one on the list is selected (I want it at the top so it shows up first in the related list on Account Page). I'm surprised there's not a default value for this field, seems like the one field you would really want a default value for. I can create a dummy field and put it first on the sort list, but seems like a lot of work just to have opportunities created in the preferable Stage! Thanks for the help btw :) 
Jacque EllJacque Ell
How does this work when the field is required? I built it but when I go to save my new opportunity, it says I need to fill it in.  I cannot make it not required either in the visibility.
Lif HuegLif Hueg
Yes - I'm wondering about this too...are you using a custom Stage field? (which shouldn't be possible either...)
Ann EzzellAnn Ezzell
I tried this, also - creating the Workflow on Opportunity as Mohammed Azam suggested - it did nothing for me.
Charles BurckmyerCharles Burckmyer
I built it as Mohammed Azam described. Worked perfectly - picked the 3rd stage in Opportunity Stage instead of the 1st, which is SFDC default. The new process builder is in Lightening Experience, so some of the syntax has changed a bit, but otherwise I just used the logic he provided and omitted the "Created Date" section as the new process builder has an 'immediate action' feature. Also, be sure to activate versus save.
Forrest Muldune 36Forrest Muldune 36
The trigger works, thanks very much everyone. 

However, for the code below, what if I want this to happen for only Opportunity record types name = Concept_Team. 

How will I include it in the code below?



trigger OpportunityTrigger on Opportunity (before insert) {
     for(Opportunity opp: trigger.new){
           opp.stagename = 'Initial Interest';
     }
}
Kaila Van FossenKaila Van Fossen
Forrest - What was the test class that you used for this trigger? It's exactly what I need but I'm not a developer so I don't really understand how to make a test class for it.