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
KMS12KMS12 

How to make the opportunity name appear while clicking the "new" button

hi,

 

I have a related list named "sales" in the opportunity module. When I click "New" button present in  the "sales" related list, i am taken to the new sales page where I can enter all the fields and save my data.

 

In the new sales page that appears I have a field called opportunity name(look up field).

 

I would like the opportunity name field to be automatically populated with opportunity name.

 

 

I need to know the piece of code which does this functionality of populating the opportunity name in the opportunity name field when I click in the "new" button of the " sales related list.

 

I have not used the default existing "new" button . I have created a new custom button with some additional functionality.

 

Please help me out.

 

Thanks,

Best Answer chosen by Admin (Salesforce Developers) 
werewolfwerewolf
The trick to populating that field is to mimic exactly the URL that is created when you click the standard button.  Make your custom button redirect to that exact same URL.

All Answers

werewolfwerewolf
The trick to populating that field is to mimic exactly the URL that is created when you click the standard button.  Make your custom button redirect to that exact same URL.
This was selected as the best answer
KMS12KMS12
Thanks a lot. It worked..