Right now, when I go to an account such as "Netflex" and click on "New Opportunity" on the related list. I then can create a new opportunity with the account name automatically populated for you. How can I do this on a custom button?


  • One way is via a url hack - google "Salesforce url hack" will bring up a ton of examples. Are you only interested in prepopulating the Account field or are there other fields you would like to prepopulate, and with what value? Adding this detail will help us provide a much more helpful answer.
    – Girbot
    Jul 15, 2015 at 21:30
  • Thanks Girbot, right now it is just the account id field.
    – user7123
    Jul 15, 2015 at 23:14

2 Answers 2


if you are trying to populate the standard Account field only, then the HTML ID that should interest you is accid :

Create button as like the screenshot below :

enter image description here

and enter button or link URL as - /006/e?retURL=%2F{!Account.Id}&accid={!Account.Id}&ent=Opportunity


You can populate the Account field through URL hacking:

put in the URL the account name as a value of page input id: /006/e?opp4={!Account.Name}

opp4 = input element id in HTML in object layout (click on inspect in browser to see the input element id)

enter image description here

the following link has detailed instructions on how to do this: https://focusonforce.com/configuration/salesforce-url-hacking/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .