How can I set a default value on a standard field in Opportunities? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Ron JenkinsRon Jenkins 

How can I set a default value on a standard field in Opportunities?

I need a way to set a default value on the Opporuntity Stage field. I can do workflow/field updates AFTER a record is created but I need the fields populated before they are saved on creation. We are using Opportunity  record types so a HTML opp11=<string> under a custom button is not a good solution. The Stage field is set throughout most of the "Sales Process" through workflow field updates. It's when the record is created that I need to set an initial value.

any suggestions?
Best Answer chosen by Moderator (salesforce.com) 
Brooke MohnkernBrooke Mohnkern
You know, if the data combinations are apparent and referenceable  at the time you press the button, you can use conditional logic in the button to set the record type. It really depends a lot on which button your users push to create the opportunity. If it is on Contacts, you can evaluate values on and associated with the contact record to pre-fill fields on the new opportunity.

Example:
...&RecordType={!IF(ISPICKVAL( Opportunity.Payment_Structure__c , 'Group Pay'), '012f00000008VJ5','012f00000008VJ6')}&...

Where the record IDs shown in this example are those of the Record Type. I'm certain this can be made more robust but you can see that record type is being set by conditions.

This example came out of a button I created on an Opportunity record that created a new Project record (custom object). The button pre-populated a dozen fields including record type and a series of other variable field entries pulled from the opportunity record itself.

All Answers

Brooke MohnkernBrooke Mohnkern

Hi Ron,

That is an interesting question. I'm thinking the custom button is most strait forward save for the record type issue you mentioned.

Tell me how the choice of record type is made. Perhaps we can code logic into your button that selects the record type automatically (if it is a standardized process) and skips over the "choose record type" screen that enters the create new opportunity flow.

 

Ron JenkinsRon Jenkins
Thanks for responding.

Their are 4 record types. They are chosen by the user in the normal way( drop list of record type selection).  The record types are:
  • Debt - New
  • Debt - Renewal
  • Debt Teaser
  • Equity
I supose I could use the replacement button and set a default record type and then update it based on certain data combinations. I'm not so sure how to replace the new button under the Opportunity (Deal) tab. List buttons are no problem. 

Thanks again.
Brooke MohnkernBrooke Mohnkern
You know, if the data combinations are apparent and referenceable  at the time you press the button, you can use conditional logic in the button to set the record type. It really depends a lot on which button your users push to create the opportunity. If it is on Contacts, you can evaluate values on and associated with the contact record to pre-fill fields on the new opportunity.

Example:
...&RecordType={!IF(ISPICKVAL( Opportunity.Payment_Structure__c , 'Group Pay'), '012f00000008VJ5','012f00000008VJ6')}&...

Where the record IDs shown in this example are those of the Record Type. I'm certain this can be made more robust but you can see that record type is being set by conditions.

This example came out of a button I created on an Opportunity record that created a new Project record (custom object). The button pre-populated a dozen fields including record type and a series of other variable field entries pulled from the opportunity record itself.
This was selected as the best answer
Anna HendryAnna Hendry
Hi Ron, if these suggestions helped, make sure to come back and let us know by marking 'Best Answer.' Thanks! 
Ron JenkinsRon Jenkins
Thaks for your help, Brooke. I will use the button and rely on the user to change the recrod type once the record is created. In other words, I'll make Debt - New the defaul and they can change after the recrod is created rather than selecting something other than the default up front. 

Thanks again.
Ron
Kishore Kumar DasariKishore Kumar Dasari

You can acheive by creating Global action on Opportunity object > Create a new record > after saving action > you can find Predefined Field Values > here you can save settings as you wish to set a field as default value.

TrailHead module:

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

Sean FieldingSean Fielding
If you need a configuration solution where the default values are set in before context (i.e. not required an additional update), check out our product on the Apps Exchange (https://appexchange.salesforce.com/listingDetail?listingId=a0N3A00000ErAwrUAF).  We can adjust the price according to your specific use case.