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
GregoryGregory 

Need help in prepopulating Contact and Opp fields in custom object

I'm familar with how to use query strings to prepopulate fields of an object on an edit.  I have no problems with prepopulating text, dates, and numbers, however have not been succesful in pre-populating references to contacts or opportunities.
 
When trying to pre-populate a custom object, the edit form renders, the text I pass in via the query string appears in the correct opportunity or contact edit box, however when you click the save button, the data is not saved.   Alternatively if I manually type in the same text in the edit box for a contact or opportunity, the data is correctly saved.     Here is an example of a url that works correctly in pre-populating a number of custom fields:
 
 
Here is a URL that populates the Opportunity field, however when you click save, the opportunity name is not saved:
 
 
What am I doing wrong?    Does salesforce not support the pre-population of field references to contacts or opportunities?
 
Thanks,
Gregory
sfdcfoxsfdcfox
You must include the ID to the record, not just its name, or Salesforce won't detect the name and it won't save the relationship. For example, if the lookup field is 00N30000000DazZ4, then the hidden field would be 00N30000000DazZ4_lkid, and you would need to provide a valid ID to the field.

For example:

...00N30000000DazZ4_lkid={!Opportunity.Id}&00N30000000DazZ4={!Opportunity.Name}...

There's other _??? fields as well... check out the source code. I believe, however, that this _lkid field is the only one that needs input to work.

~ sfdcfox ~

Message Edited by sfdcfox on 05-22-2007 10:40 PM

GregoryGregory
Dear sfdcfox,
 
Thank you!   That solved the problem.   Must pass in both the opportunity Name and Id in the query string to correctly pre-populate the field.   Thanks for the fast response.
 
Gregory