Prepopulating fields using URL hacking – Part 1: The Basics
Prepopulating fields using URL hacking – Part 2: Prepopulating custom fields
Prepopulating fields using URL hacking – Part 3: Handling Special Characters
Prepopulating fields using URL hacking – Part 4: Passing in the Record Type
Prepopulating fields using URL hacking – Part 5: Multi-Select picklists
In my series of posts on URL hacking, I explored how to pre-populate fields on Salesforce pages by passing the values in the page URL. In most Salesforce environments, there are multiple record types created on several objects. This can cause an issue with passing values in the URL, because whenever you visit an object create page, it first asks you for a record type.
For e.g., I set up two record types called “Internal” and “External” for the contact object, and it prompts me to choose the record type before proceeding.
To get around this, I started passing in the record type in the URL itself. Below is the URL I am using :-
https://na9.salesforce.com/003/e?retURL=%2F003%2Fo&RecordType=012E00000001nGY&ent=Contact&name_firstcon2=TestFName&name_lastcon2=TestLName |
As highlighted above, you can actually pass in the record type ID in the URL. This will “preselect” what record type object you are creating, and hence you would not have to explicitly select the record type.
Since Salesforce requires that the Record type ID be passed, how do we get the record type ID ? Simply go into Setup—> Create –> Objects –> Record Types. When you look at the record type definition in Salesforce, the URL contains an ID field – this is the ID for your record type.
As an example, when I look at my record type, it’s URL is this (record type ID is highlighted) :-
https://na9.salesforce.com/setup/ui/recordtypefields.jsp?id=012E00000001nGY&type=Contact&setupid=ContactRecords |
So this way, you can easily pass the record type in the URL itself, to avoid explicitly selecting the record type.
great jod!
ReplyDeletehow about check box field?