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
WeetzWeetz 

Setting Id value for a custom reference field in an S-control

I created a custom lookup/reference field in the opportunity record called Registered_By which is a reference to a user record.  The API name for the field is 'Registered_By__c'.  In an S-control, I am trying to update this field with the Id of the user who created the lead that was converted.  The assignment for the Id field is giving me an error: "id value of incorrect type".  Here is the code:
 
var op = new Sforce.Dynabean("Opportunity");
op.set("id", opptId);
op.set("recordtypeid", document.editPage.orecordtype.value );
op.set("Contact_City__c", "{!Lead.City}");
op.set("Contact_Company__c", "{!Lead.Company}");
op.set("Contact_Country__c", "{!Lead.Country}");
op.set("Contact_Email__c", "{!Lead.Email}");
op.set("Contact_First_Name__c", "{!Lead.FirstName}");
op.set("Contact_Last_Name__c", "{!Lead.LastName}");
op.set("Contact_Phone__c", "{!Lead.Phone}");
op.set("Contact_State__c", "{!Lead.State}");
op.set("Contact_Zip_Postal_Code__c", "{!Lead.PostalCode}");
op.set("Contact_Title__c", "{!Lead.Title}");
op.set("Registered_By__c", "{!Lead.CreatedById}");  <- This line causes the error
var sr = op.save();
 
What am I doing wrong?
 
Thanks!
MKPartners.comMKPartners.com
I'm not sure, but check within the s-control editor in sfdc to see if there is a merge field for Registered_ById__c.