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
Vinay_guptaVinay_gupta 

Set default Opportunity sales stage name default

Hi All,



I want to prepopulate the stage name in Opportunity sales stage with "Prospecting" at the time of new opportunity creation. Can you please suggest me where I can configure the default value sales stage?
User-added image
NagendraNagendra (Salesforce Developers) 
Hi Vinay,

sorry for this issue you are facing.

May I suggest you please give a try by using below piece of trigger code which might help.
trigger OpportunityTrigger on Opportunity (before insert) {
     for(Opportunity opp: trigger.new){
           //You can setup stage name here
           opp.stagename = 'Initial Interest';
     }
}
Also, refer to below link for more help with a similar discussion. Please let us know if this helps.

Kindly mark this as solved if the reply was helpful so that it gets removed from the unanswered queue which results in helping others who are facing a similar issue.

Thanks,
Nagendra
Vinay_guptaVinay_gupta
Hi Nagendra,

I wanted to prepopulate the Stage name at the time when a user clicks on a new Opportunity button. I am not sure whether the above suggestion will help here.

May I know if I need to do any configuration setting?

-Vinay


 
Vinay_guptaVinay_gupta
Hi ,

I created the opportunity by writing the trigger but it is not populating the stage default. Please suggest.
GulshanRajGulshanRaj
Hi @Vinay_gupta,

If you are in lightning, we have one solution which a is bit lengthy but effective. It works for me.

Step 1) Create lightning component:
<aura:component implements="force:lightningQuickAction,lightning:actionOverride" >
	<aura:handler name="init" value="{!this}" action="{!c.doInit}" /> 
</aura:component>

Js Controller
({
	doInit: function(component, event, helper) {
      var createAcountContactEvent = $A.get("e.force:createRecord");
      createAcountContactEvent.setParams({
          "entityApiName": "Opportunity",
          "defaultFieldValues": {
              'StageName' : 'Prospecting'
          }
      });
      createAcountContactEvent.fire();
	}
})



Step 2) Override standard opportunity new button with this lightning component:
User-added image


Please let me know if you have any question.


Thanks
Gulshan Raj 

(https://www.linkedin.com/in/gulshan-raj-a26b0640)
Raj VakatiRaj Vakati
You no need to write the .. try like this ... 
  1. Create a Quick action to create a new record and populate the predefined values 
https://trailhead.salesforce.com/en/modules/salesforce1_mobile_app/units/salesforce1_mobile_app_actions_objectspecific
2 . Remove the new standard button and replace it with the quick action which created ...  
Raj VakatiRaj Vakati
Refer this link 

https://trailhead.salesforce.com/en/modules/salesforce1_mobile_app/units/salesforce1_mobile_app_actions_objectspecific
https://developer.salesforce.com/docs/atlas.en-us.salesforce1.meta/salesforce1/actions_about.htm

https://trailhead.salesforce.com/en/modules/salesforce1_mobile_app/units/salesforce1_mobile_app_actions_global

https://trailhead.salesforce.com/en/modules/salesforce1_mobile_app/units/salesforce1_mobile_app_actions_objectspecific
Vinay_guptaVinay_gupta

Hi All,
Thanks for the Resolution.

Is creating a Component and overriding the standard 'NEW' button is the only way?
or
Is this something Configurable since I am looking for the solution which can be configured at the application end?

Thanks