Written by: MarkBoyer 10/22/2009 9:10 AM
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.
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.
Copyright ©2009 Customer Connect
2 comments so far...
Re: Setting a default value of a field in Salesforce Hi Mark,This is a great help. I am trying to have the Billing Country default to USA (I currently have a field update set up). I've located the ID of the field, but when I create a new account, the URL is a lot longer than the example you have posted above. I get this:https://na7.salesforce.com/setup/ui/recordtypeselect.jsp?ent=Account&retURL=/001/o&save_new_url=/001/e%3FretURL%3D%252F001%252FoI am missing something? Wondering why it is so long and where I might add the ID of the field?Best,Courtney
Re: Setting a default value of a field in Salesforce
Hi Mark,This is a great help. I am trying to have the Billing Country default to USA (I currently have a field update set up). I've located the ID of the field, but when I create a new account, the URL is a lot longer than the example you have posted above. I get this:https://na7.salesforce.com/setup/ui/recordtypeselect.jsp?ent=Account&retURL=/001/o&save_new_url=/001/e%3FretURL%3D%252F001%252FoI am missing something? Wondering why it is so long and where I might add the ID of the field?Best,Courtney
Re: Setting a default value of a field in Salesforce Courtney,All you need to do is append to the end of your URL and make sure you delimit the fields with an '&'. If you were using the example I showed here, you'd just put the "&opp3=test" on the end of the URL like this:https://na7.salesforce.com/setup/ui/recordtypeselect.jsp?ent=Account&retURL=/001/o&save_new_url=/001/e%3FretURL%3D%252F001%252Fo&opp3=testJust remember the "?" and "&" are delimiters. The ? begins the list of parameters so it will always seperate the parameters from the destination URL. Every parameter must be seperated by the "&".Hope this helps,Mark
Courtney,All you need to do is append to the end of your URL and make sure you delimit the fields with an '&'. If you were using the example I showed here, you'd just put the "&opp3=test" on the end of the URL like this:https://na7.salesforce.com/setup/ui/recordtypeselect.jsp?ent=Account&retURL=/001/o&save_new_url=/001/e%3FretURL%3D%252F001%252Fo&opp3=testJust remember the "?" and "&" are delimiters. The ? begins the list of parameters so it will always seperate the parameters from the destination URL. Every parameter must be seperated by the "&".Hope this helps,Mark