+ Start a Discussion
Thakkar ParthThakkar Parth 

auto fill account name on contact

Hi,

Have a requirement where on clicking a button ( custom buttom )  it will take me to the Contact detail page with auto filled Account Name field.
Please help me . I'm confused and any sample code will work best for me . Thanks .Marc

Best Answer chosen by Thakkar Parth
David "w00t!" LiuDavid "w00t!" Liu
URL hack will do the trick buddy!  This is a classic use case:
http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html

All Answers

logontokartiklogontokartik
So when you said detail page? Are you creating a new contact and you want to auto fill account? 

you can use URL Param "accid" and populate field, something like accid=001o0000006VvOE, it should autofill account for you
Nilesh Jagtap (NJ)Nilesh Jagtap (NJ)
Hi,

You can enabled salesforce feature for autocompleting lookups--

With lookup auto-completion, users can select items from a dynamic list of matching, recently used records when editing a lookup field. Lookup auto-completion is available on account, contact, user, and custom object lookups. To enable it:

   >> Click Your Name | Setup | Customize | Search | Search Settings.
   >> In the Search Settings area, select the object lookups for which you want to enable auto-completion.
        Currently, only account, contact, user, and custom   object lookups can use this feature.
    >>Click Save.

For more info please go through - https://help.salesforce.com/apex/HTViewHelpDoc?id=search_enhanced_lookup_enable_autocomplete.htm&language=en (https://help.salesforce.com/apex/HTViewHelpDoc?id=search_enhanced_lookup_enable_autocomplete.htm&language=en)

Thanks,
N.J
Thakkar ParthThakkar Parth
@logontokartik , sorry, its not detail page. My requirement is , when i click on button, it should redirect me to Contact page (Where we create new contact ) and with this Account Name field should be auto populated. 

Can anyone of you pls provide me sample code to redirect to the page and how I can auto populate Account field.
Prem_PalPrem_Pal
Are we talking about a VF page for contact or the native standard page?
David "w00t!" LiuDavid "w00t!" Liu
URL hack will do the trick buddy!  This is a classic use case:
http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html
This was selected as the best answer