You need to sign in to do that
Don't have an account?
arun 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
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.
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
That is correct, you will need to build a visualforce page.
Thanks for this tip Kyle!
If working on a pure LWC (no Aura or VF composition) then you can use:
If you are working on a Lightning Out app, ie VF/Aura composition (VF -> Aura -> LWC) then you can pass your default field value map from the LWC to the parent Aura component via a CustomEvent:
In Aura you can handle the CustomEvent and then call the recordCreate API:
This will open the standard record create page with all of your values defaulted.