Pre-Populate fields on button/Link

Many times we need to pre-populate some field while creating/updating a record on button/Link click. It may be on custom visualforce page or standard layout.

1) Prepopulating Text, Number fields on Standard Pagelayout:

/Var1/e?CFVar2=Var3&retURL=%2FVar4

Var1=3 char code of object (i.e Account=001, Contact=003 for Custom/Other object click on Object  
                                                  Tab to get unless object Tab is not override)
Var2=SFDC Id of the field need to pre-populate.
Var3=Value need to populate (may be hard coded or variable per requirement i.e {!Account.Name})
Var4= URL need to redirect after record Save.

e.g /00T/e?CF00NA0000005pr8F=1&retURL=%2F{!Lead.Id}

2) Prepopulating Lookup fields on Standard Pagelayout:

for Lookup prepopulate we need to map field Id and Name both. e.g. 

/003/e?CF00NA0000003KWvS_lkid={!Contact.Id}&CF00NA0000003KWvS={!Contact.Name}

3) Prepopulating Lookup fields on Visualforce Page:

/apex/ YourVF Page Name?CF00NA0000005pr8F=1&retURL=%2F{!Lead.Id}

4) Prepopulating Standard fields:
There are code for some standard fields on standard and Custom fields. e.g 

/p3_lkid=ParentId&p2_lkid=Id&p4=To&p6=Subject&p7=Description





Comments

Popular posts from this blog

Useful SFDC Link

PRODUCTION SUPPORT – COMMON ERRORS IN SALESFORCE

Salesforce Developer Interview Questions