function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jeff SusichJeff Susich 

Prepopulating a Field during record creation

I have a custom object that has a master-detail relaionship with Opportunities. The custom object is called "Invoices". I want to prepopulate some fields in the "Invoices" record using a custom button. 

The ID of  the currency custom field on the Opportunity that I am interested in is 00N50000002UECs. I want to have the value in this currency field prepopulate to my custom field 00N50000002UECe on my custom object when I create a new record. 

I am having trouble referencing the Opportunity field in my URL so that it prepopulates the custom field on my custom object. 

My button URL code is the initlal standard URL plus &00N50000002UECe=00N50000002UECs

This results in the text value "00N50000002UECs" prepopulating in the field. How do I reference the field that is on the Opportunity that is related to the custom "Invoice" object?
Best Answer chosen by Jeff Susich
Saurabh DhobleSaurabh Dhoble
Jeff,

You need to pass the actual value of the Currency custom field instead of the ID of the field. I've written a series on this - check it out and keep it as a reference for any other fields you are trying to pass in the URL.

http://writeforce.blogspot.com/2012/12/prepopulating-fields-using-url-hacking.html

Let me know if this helps.

--Saurabh.

All Answers

Saurabh DhobleSaurabh Dhoble
Jeff,

You need to pass the actual value of the Currency custom field instead of the ID of the field. I've written a series on this - check it out and keep it as a reference for any other fields you are trying to pass in the URL.

http://writeforce.blogspot.com/2012/12/prepopulating-fields-using-url-hacking.html

Let me know if this helps.

--Saurabh.
This was selected as the best answer
Jeff SusichJeff Susich
Most excellent. Thanks. 
Jeff SusichJeff Susich
The blog is very useful. But I still cannot figure out how to reference another object to pass in the value in a custom field. 

When I inspect the element with the field I want to populate I get "input id ="00N50000002UECe" name ="00N50000002UECe". When I try and use the logic ".....&00N50000002UECe=00N50000002UECs" I get the text 00N50000002UECs in the field. I'm not telling salesforce that this field is on the Opportunity object, not on the custom object record I am creating. 

Any ideas appreciated. 


Saurabh DhobleSaurabh Dhoble
You need to pass in the value of the field -
for e.g., I assume that you are creating a custom button or link. When you construct the URL, it should look something like this -

/e?retURL=%2F001E000000KC75x&00N50000002UECe={!Opportunity.Currency}
This will pass in the text of the currency field in the URL, instead of the ID of the currency field. Let me know if this works.