background preloader

Prepopulate fields

Facebook Twitter

HTML URL Encoding Reference. Community - Pre-populating field on Visualforce Page from url - Force.com Discussion Boards. Prepopulating values from a visualforce page to a standard page. Once I had this requirement, wherein I was asked to pre-populate some of the values from a visualforce page to a standard page.

Prepopulating values from a visualforce page to a standard page

The flow can be like this (just an example): 1. Create a custom List button on Account, let's name it "Quick Account". 2. This button opens a visualforrce page. 3 . 4. 5. The idea is that the name of the fields on the HTML have some very standard conventions. e.g. for account object, Account Name field had the HTML Id as 'acc2'. Also for custom fields, the salesforce Id is used as HTML id. e.g. let us say a custom field on Account is 'My Name' and the salesforce Id of the fields is 'xxxxxxx'. And again bingo........ Happy clouding :) How to pre-populate fields in Salesforce.com. Salesforce developers often need to launch a custom object in new or edit mode.

How to pre-populate fields in Salesforce.com

This tutorial will show you how to pre-populate field values using querystring parameters. Let's look at the standard Salesforce.com URL for an account object. - This means it is using a secure server.na9. - This is the server.salesforce.com - This is the domain./001 - This is the object type. 001 = Account/e - This represents new or edit mode. Note: If you replace 001 with a 15 or 18 character account Id the /e would allow you to edit the record.

As it is shown above (3 characters - 001) it allows you to create a new record. By adding querystring parameters we can automatically populate fields when the page loads. By adding ? As you probably noticed in the URL above, the first querystring parameter must follow a question mark (?). Let's automatically set the website field to ' and the description field to 'Salesforce Certification Help and Source Code Articles'. acc12= acc2=Bulkified&acc12= Salesforce: Pre-populate Fields Using URL Parameters. For my example I am going to pre-populate some fields on the contacts object.

Salesforce: Pre-populate Fields Using URL Parameters

Now the contacts object (like all salesforce objects) has what salesforce sometimes refers to as a front door for the URL. Quite simply the front door for the contacts tab is "/003/o". The front door for a new contact would be "/003/e". If you want to see what the front door is for any object simply click the tab for the object. The front door is the three characters directly following the ".salesforce.com/" portion of the URL while you are on the tab's "home" screen. So now what? Using this information we can now add a new contact using nothing more than parameters passed in the URL.

Breakdown of URL: Front Door for new contact record: /003/e Salutation for new contact: ? Putting it all together: Hopefully, most people reading this are using contacts in their orgs and, therefore, should be able to cut and paste the string from my example into a browser and see exactly what I’m trying to illustrate. Author.