You need to sign in to do that
Don't have an account?
Kartik
Error Updating Custom-Lookup field on Lead.
Hi,
We have an s-Control which updates around 180 fields in a lead. I made the following changes:
1. Added a new Field with a label called "Referring Facility (Lookup)" and made it accessible by everybody. This field type is lookup and refers to the Facility Custom object.
2. Modified the S-Control to update this field. Below is the code which 'sets' the property.
newLead.set("Referring_Facility_New_Lookup__c", document.leadForm.referringFacility.options[document.leadForm.referringFacility.selectedIndex].value);
But the Ajax toolkit throws the following exception at this point:
"The property Referring_Facility_New_Lookup__c is not a valid field".
We have an s-Control which updates around 180 fields in a lead. I made the following changes:
1. Added a new Field with a label called "Referring Facility (Lookup)" and made it accessible by everybody. This field type is lookup and refers to the Facility Custom object.
2. Modified the S-Control to update this field. Below is the code which 'sets' the property.
newLead.set("Referring_Facility_New_Lookup__c", document.leadForm.referringFacility.options[document.leadForm.referringFacility.selectedIndex].value);
But the Ajax toolkit throws the following exception at this point:
"The property Referring_Facility_New_Lookup__c is not a valid field".
Verified the following:
1. Generated enterprise WSDL and the field existed in the generated WSDL.
2. Ran a test query in the SForce Explorer but explorer throws an INVALID_FIELD exception.
3. DescribeSobject function does not return this field in the result.
Any idea what could be happening?
Thanks.
-Kartik
This kind of thing works fine for me....
dr = sforceClient.describeSObject("test__c");
alert("name of result = " + dr.name);
alert("describe results = \n" + dr);
var n = new Sforce.Dynabean("test__c");
n.set("Referring_Facility_New_Lookup__c","0013000000B67jF");
alert ("it's set now");
Things to check for:
Are you sure you set the *Name* of the new field to "Referring_Facility_New_Lookup"? Note, the *name* as opposed to the Label. The name is what's used to build the fieldname in the dynabean mapping, your note mentions the Label, but not the Name.
Are you sure you're logging in with the correct username/account and to the correct service? production at www.salesforce.com vs. sandbox at test.salesforce.com. (This is moot if you're not using a sandbox account, or if you're testing it by loading it into the S-control directly and you don't override the serverUrl in your code.)
It's good to see it in the Enterprise WSDL, but it shouldn't matter because the describe should see it. You are doing the describe on the "Lead" object correct? I don't know why you're not seeing it there, I see it in the above example... under the mappings in the dr object.
In your code, (although this shouldn't relate to not seeing it in the describe object), are the values in your Options to the Select element ID's or text? You need to be .set'ing with ID's.
Good luck, Steve Bower.
Thanks for your response.
All custom fields except for Referring_Facility_New_Lookup__c on the Lead object show up on a DescribeSObject call. This behaviour is specific to the Lookup Type referring to a custom object on the Lead. If a field on a Custom Object say (Facility) refers to a Lead through a Lookup field type the field shows up in all places(including the DescribeSObject call). If the field type of Referring_Facility_New_Lookup__c on the Lead object is changed to a text field or any other field type(except Lookup), there are no issues.
Secondly I am facing this issue in our Production Org and I do not override the URL anyplace.
-Kartik
So, I'm no help. :-) Check the spelling and good luck! :-)
Steve.
Found solution to the problem I was using
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_60}");
instead of
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}");
Since 'Lookup' is a new field type, it probably makes sense that call to the 6.0 version did not return the field whereas the one for 7.0 did return.
Thanks for all the help.
-Kartik