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
JJamesJJames 

Populating objects from custom button URL field

I am having a small issue populating 2 fields in my custom button, everything else seems to work fine but the account field does not populate anything and I cannot populate a user in the account contact field.  comments by the problem areas. code:
 
/setup/ui/recordtypeselect.jsp?ent=01I3B0000008YRp&
retURL=%2F{!Opportunity.Id}&
save_new_url=%2Fa2C%2Fe%3F{!Opportunity.Name}
accid={!Opportunity.Id}&
CF00N3B000000OKFI={!Opportunity.Primary_Contact__c}&
CF00N3B000000OKFI_lkid={!Opportunity.Primary_Contact__c.UserId}&//not sure how to reference the user id here?
CF00N3B000000OKFz={!Opportunity.Name}&
CF00N3B000000OKFz_lkid={!Opportunity.Id}&
CF00N3B000000OKFB ={!Opportunity.Account}&//this field is left blank, but these references work in any other field i assign them to
CF00N3B000000OKFB_lkid={!Opportunity.AccountId}&
00N3B000000OKFR={!Today()+90}&
Name=Quote For {!Opportunity.Name}

and in fact i would rather have the primary user in the related list Contact Roles as the Account contact.  Any help is greatly appreciated!
Prabhat Kumar12Prabhat Kumar12
On this line you can use only {!Opportunity.Primary_Contact__c.id} . Because this field seems a contact field and you need to use id in contact lookup field.

Try to change {!Opportunity.Account} to ​{!Opportunity.AccountId} .

Let me know if does not work.
JJamesJJames
it gives me an error when using 
 {!Opportunity.Primary_Contact__c.id} 
Error: Field Opportunity.Primary_Contact__c.id does not exist. Check spelling.

the primary_contact__c is a  lookup(Contact) if that makes a difference
 
Prabhat Kumar12Prabhat Kumar12
Use this 

 {!Opportunity.Primary_Contact__r.id}  this will work.
Jayson Faderanga 14Jayson Faderanga 14
what Prabhat suggest is good..you're referencing a foreign entity, you need to append __c with __r for the system to get the right value for reference.