In Salesforce, the most important and fun interactive way playing with the pre-populated fields is done with the help of URL Hacking.
Hey! Hey! Hey! This URL Hacking is not that Unethical hacking, Its for the business use as per your company’s need. In Salesforce world, the process of pre-populating fields is a very basic and old age thing.
Let’s take an example of what pre-populating field means in Salesforce. As a newbie to Salesforce, one can only know how to add record on Account object. But for knowing how Salesforce is a fun playground in your working Business Logic, one can add multiple Opportunity Records form the Account’s related list. As per the standards, the Salesforce open up an edit page for creating new Opportunity record from the standard “NEW” button from the Account detail page Related List. So if your company scenario is like if an account is created by a certain particular values then the related Opportunity records should have Stage “Developing”, then you can take advantage of this URL Hacking.
Explaining the URL of Salesforce that will navigate to a new create page of Opportunity record from Account related list.
/006/e -- “006” is a three letter prefix, which signifies the sobject and “/e” signifies the edit page. Here “006” is for opportunity.
NOTE: You can get prefix of sobject by this Schema.getGlobalDescribe().get('Opportunity').getDescribe().getKeyPrefix()
retURL -- it is used for returning the page when “Cancel” option is selected.
%2F0010K00001eMcMe -- “0010K00001eMcMe” is the id of Account record from where the related opportunity record is to be created and “%2F” is decoded as “/”.
accid -- this parameter is used to pre-populate the “Account” lookup on the Opportunity create page.
& -- this is used to separate two different fields.
Now if you want to prepopulate the different fields on the Opportunity creation page, you want the specific parameter for each and every field just like “accid”.
So if you want to pre-populate the “Opportunity Name” field you have to use “opp3” as the field id of that text field. Woooaaahhh How can I get that??? It’s not a miracle, anyone can get this by using “Inspect” in your browser. Just hover the mouse cursor over field you want to pre-populate. Then you get the field id in the “Inspect” section.
Let’s take an another field id. Suppose you want to pre-populate “Close Date”, then you want to give a particular value against “opp9”. Like
Now after this URL hacking, the pre-populated fields are shown like this.
For more stay tuned to the next episode of URL Hacking…