Find your content:

Search form

You are here

Custom "New Contact" button on Account detail page


I've a created a custom button on Contact object and added this to Contact Related-list on Account's Page layout. I want this to depict same functionality as standard "New Contact" button does. If use following code then it doesn't pre-populate the Account lookup field.


Is there any way to do so?

Attribution to: doga

Possible Suggestion/Solution #1

Try using'{!URLFOR($Action.Contact.NewContact, Contact.Id )}');

Update : try this : click on inspect element on the lookup button and you can find Id of the lookup as con4_lkwgt (I would assume this to be same since its a standard field) and click on the account name field and get the ID as con4


Refer this blog for more insight on how to override the buttons

Attribution to: Rao

Possible Suggestion/Solution #2

You'll have to look at the field names. The list of names for standard fields is for example here:, for custom fields it's usually the field Id when viewed in setup (in case of doubt use Firebug or similar tool to inspect the HTML).

Something like this should give you the general idea how to start:


It's up to you if you want to write full URL yourself or do you prefer to read a bit more about URLFOR function (quite powerful). Generally speaking this will populate Account nicely if you've fired it from rel. list under Account - from other places it is likely to return empty string so you might have to use CASE() or similar to make it more generic (depends on when do you plan to use the button).

Attribution to: eyescream
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content