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
shawnjcloseshawnjclose 

Code for custom buttom

I created a custom buttom. Is there code for when I click the button to create an Opportunity it fills in the the Opportunity field?

Andy BoettcherAndy Boettcher

Are you talking about the "Opportunity Name" field?

V1nitV1nit

Create a custom button with type "URL" and use the below url.

 

Use this if you are in a sandbox environment:

https://test.salesforce.com/a0E/e?retURL={!Opportunity__c.Id}&Name=sample

 

 

Use this if you are in a production environment:

https://ap1.salesforce.com/a0E/e?retURL={!Opportunity__c.Id}&Name=sample

 

Both the above URL's will take you to a new page with the name of the opportunity pre-populated.

As an example this will populate the opportunity name as "sample". Replace that with whatever you like and also you can use merge fields for dynamic data to be populated under opportunity name.

 

If you still need any clarification reply to this message.

 

Thanks.