+ Start a Discussion
arun kumar.ax887arun kumar.ax887 

How to set Default values to Standard Fields

Hi,

 

     I have a requirement where in the default values have to be set for the Standard Field of Opportunity i.e. Opportunity Name, could any one suggest a solution for this. 

 

 

Thanks & Regards

 

Arun

 

kyle.tkyle.t

Most likely a New button override.  Are you defaulting to the account name? If so you could create a button for the Opportunity related list on the account page layout.  I will assume that you want to default to "<Account Name> - " for the opportunity.

 

First, go to an account and click the New Opportunity button.Note the URL.  In my developer environment it is:

https://na7.salesforce.com/006/e?retURL=%2F001A0000004WTpk&accid=001A0000004WTpk

 

Now, in your browser, click View > Page Source.  Search for "Opportunity Name" and find the ID associated with the Opportunity Name.  In my environment it is "opp3"

 

Now go to Setup > Customize > Opportunities > Buttons and Links anc create a new button. Name it New Opportunity, make it a List Button and set behavior to open in existing window without sidebar or header.

 

copy every thing from you link above after salesforce.com in to the formula:

/006/e?retURL=%2F001A0000004WTpk&accid=001A0000004WTpk

 

In this url, the retURL is the account id as well as the accid, so we need to replace those

/006/e?retURL=%2F{!Account.Id}&accid={!Account.Id}

 

Finally, you need to populate the Opportunity Name field: opp3

/006/e?retURL=%2F{!Account.Id}&accid={!Account.Id}&opp3={!Account.Name}+" - "

 

Now add this button to the account page layout on the related list for the opportunity (don't forget to remove the old one) and when you create an opportunity it will default to the account name.

 

Additionally you may want to add a validation rule that the Opportunity name is not equal to "<Account Name> - " which will make the users update the name.

 

a_beckera_becker

I was successfully able to create a List Button that appears on the Account page layout in the Opportunity related list so when a user clicks "New Opportunity" the Opportunity Name field has a default value.

 

However, I want this default value to appear whenever the user creates a new Opportunity (i.e. also from the Opportunity tab when they click "New" button). Any suggestions how to do this? Seems like I need to create a Visualforce page - is that right??

 

Cheers

kyle.tkyle.t

That is correct, you will need to build a visualforce page.

Marc C.Marc C.

Thanks for this tip Kyle!

DEEPTHIREDDY KESIREDDYDEEPTHIREDDY KESIREDDY
How can we do it in lightning?