Friday, May 18, 2012

Setting a default value of a field in Salesforce

Posted in By Amber Butler @ 10/22/2009 2:03 PM

Over a year ago, I read about a feature on Salesforce and haven't been able to found where I read it, or another post about it so I decided to post here. 

In Salesforce, it's possible to configure the URL of a link in the application using a formula.  You can also override the existing functionality of the "NEW" button.  This is where this functionality is useful as it allows you to prepopulate values to be displayed on your entry form.

Each of these values would be passed into the edit page as parameters on the URL.

For instance, if you are creating a new opportunity, your URL when clicking the "New" button might look something like this:

https://na6.salesforce.com/006/e?retURL=%2F006%2Fo

The only parameter here is the return URL. 

To set the default value, you can view the page source and identify the id of the field you want prepopulated with a value.  One thing I do want to point out is that I don't know how often if ever these ids change, but I did read about this feature over a year ago somewhere in the Salesforce.com help or supporting documentation and it was supported then.

To set this up, I use the browser to view source of the page where I want data prepopulated and identify the input field used for the field I want to set a default value:

<input id="opp3" maxlength="120" name="opp3" size="20" tabindex="1" type="text" value="" />

Then, I simply added to the URL the id of the field and the value I want to set:

https://na6.salesforce.com/006/e?opp3=test&retURL=%2F006%2Fo

Now, when the page opens, the data is prepopulated in the opportunity name field and the source now has the default value.

<input id="opp3" maxlength="120" name="opp3" size="20" tabindex="1" type="text" value="test" />

This is a quick and easy way to set default values on a field in Salesforce.

Comments

Got something to say? Join the discussion »

leave a reply

 [Quick Submit with Ctrl+Enter]

Remember my details
Notify me of followup comments via e-mail

C5_Insight

About C5 Insight

We are a Microsoft Gold Certified partner focusing on SharePoint, Microsoft Dynamics CRM and Salesforce.com.  Learn more about us by visiting our website.

Search

We Wrote the Bible on Microsoft SharePoint and Dynamics CRMBook-Microsoft Dynamics CRM 2011 and SharePoint 2010 Bible

Tags

Maximize

Recent Comments

Maximize

Blog Roll

Maximize

Disclaimer

The information herein may be used solely at your own risk.  No warranty is made by the author or by C5 Insight, Inc.

The opinons expressed herein are those of the individual authors and do not necessarily represent C5 Insight, Inc in any way.

Copyright 2011 by C5 Insight