You need to sign in to do that
Don't have an account?
WahibIdris
INVALID_FIELD: Field name provided, does not match an External ID for Case
I am trying to make upsert call to sandbox using Partner WSDL through my .NET application but getting Invalid External id field error. Not sure why the external Id Name is correct and its unique in Salesforce. Please let me know if I am missing something. Below is my code snippet. Thanks
public void upsertCASE() { try { // Create a new sObject of type Case // and fill out its fields. sObject CASE = new SFDC.sObject(); System.Xml.XmlElement[] CASEFields = new System.Xml.XmlElement[4]; // Create the Case's fields System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); CASEFields[0] = doc.CreateElement("Status"); CASEFields[0].InnerText = "Working"; CASEFields[1] = doc.CreateElement("Description"); CASEFields[1].InnerText = "Case Created by Partner API"; CASEFields[2] = doc.CreateElement("Origin"); CASEFields[2].InnerText = "Web"; CASEFields[3] = doc.CreateElement("External_ID_POC__c"); CASEFields[3].InnerText = ExternalId; CASE.type = "Case"; CASE.Any = CASEFields; // Add this sObject to an arrayExternalId sObject[] CASEList = new sObject[1]; CASEList[0] = CASE; UpsertResult[] results = null; LimitInfo[] LimitInfo = null; // Make a create call and pass it the array of sObjects client.upsert(header, null, null, null, null, null, null, null, null, null, null, null, null, ExternalId, CASEList, out LimitInfo, out results); // Iterate through the results list // and write the ID of the new sObject // or the errors if the object creation failed. // In this case, we only have one result // since we created one contact. for (int j = 0; j < results.Length; j++) { if (results[j].success) { Console.Write("\nA CASE was created with an ID of: " + results[j].id); } else { // There were errors during the create call, // go through the errors array and write // them to the console for (int i = 0; i < results[j].errors.Length; i++) { Error err = results[j].errors[i]; Console.WriteLine("Errors were found on item " + j.ToString()); Console.WriteLine("Error code is: " + err.statusCode.ToString()); Console.WriteLine("Error message: " + err.message); } } } } catch (SoapException e) { Console.WriteLine("An unexpected error has occurred: " + e.Message + " Stack trace: " + e.StackTrace); } }