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 

Custom Button Errors

I have a URL custom button on the Contact object. I'm testing in a sandbox. 

https://cs16.salesforce.com/a0F/e?retURL=%2Fa0F%2Fo 
&CF00Ni000000EecqT={!Contact.Name} 
&CF00Ni000000EecqT_lkid={!Contact.Id} 
&CF00Ni000000EedPO={!Contact.Current_Coach__c} 
&CF00Ni000000EedPO_lkid={!Contact.Current_CoachId__c} 

The Contact name is a Lookup to the standard Contact object, and the Current_Coach__c is a User lookup. The button is designed to take both of those ID's off of the Contact record and populate it on the new custom object record. 

When I use the button, it populates the Contact Name in new record in the "aOF" custom object correctly in the Contact Lookup field, and the "Current Coach" user name in that field, but when I try and save the record it tells me that the " id value of incorrect type: 003f000000nSZndXXXXXXXXXXX", which is the correct salesforce ID for the Contact, but the "XXXXXXXXXX" is the username of another user. The "Current Coach" also has an "id value of incorrect type: 005i0000006I7sH0", which is the correct user ID, BUT with a "0" at the end of it.  

So my code is appending a User Name to the Contact Lookup, and a "0" at the end of the "Current Coach" user Lookup. 

Any ideas on what is going on would be appreciated. 
Abhishek BansalAbhishek Bansal
Hi Jeff,

It can be clearly seen in the URL that you are passing two values for the same field i.e. 
https://cs16.salesforce.com/a0F/e?retURL=%2Fa0F%2Fo 
  1. &CF00Ni000000EecqT={!Contact.Name}  &CF00Ni000000EecqT_lkid={!Contact.Id} 
  2. &CF00Ni000000EedPO={!Contact.Current_Coach__c} &CF00Ni000000EedPO_lkid={!Contact.Current_CoachId__c} 
You can see in both lines that the field id which you are using is same whic means that two values are assigned for a single field that is why you are getting error.

Please use different field ids to store name and lookup field in different fields.
You can go with the below code also if you just want to save lookup fields only :
https://cs16.salesforce.com/a0F/e?retURL=%2Fa0F%2Fo 
&CF00Ni000000EecqT_lkid={!Contact.Id} 
&CF00Ni000000EedPO_lkid={!Contact.Current_CoachId__c}
Please let me know if you need more clarification or any help on this.

Thanks,
Abhishek