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
mahendran c 2mahendran c 2 

Updating Owner in Work_Assignment__C

Hi Team,
I am using SOAP api with C# environment, trying to update the Owner in  "Work_Assignment__c". but am getting the issue "The external foreign key reference does not reference a valid entity: Owner". I can able to get Owner Id, Owner Name by using Owner.Id,Owner.Name field.
Please hel me to resolve this issue and below is my code.

sObject attach = new sObject();
 System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
 attach.type = "Work_Assignment__c";
 attach.Id = "a1O0n000000DLZ4EAO";
attach.Any = new System.Xml.XmlElement[1];
attach.Any[0] = xmlDoc.CreateElement("Owner");
attach.Any[0].InnerXml = "0050n0000017hBGAAY"; // Owner Id
SaveResult[] results;
LimitInfo[] limitInfo;
List<sObject> attchmentlist = new List<sObject>();
attchmentlist.Add(attach);
queryClient.update(header, //sessionheader 
                                  null,   //calloptions1 
                                  null,   //assignmentruleheader 2
                                  null,   //mruheader 3
                                  null,   //allowfieldtruncationheader4 
                                  null,   //disablefeedtrackingheader 5
                                  null,  //streamingenabledheader 6
                                  null,   //allornothingheader 7
                                  null, //DuplicateRule header8
                                  null, //Loacaleoption9
                                  null,   //debuggingheader10 
                                  null,   //packageversionheader11 
                                  null, // emailheader
                                  null,   //emailheader 
                                  attchmentlist.ToArray(), //new attachment or issue or anyother object 
                                 out limitInfo,
                                  out results //result of create operation 
                                  );


 
SandhyaSandhya (Salesforce Developers) 
Hi,

Try to query in query editor of developer console to check if that ownerId exists and also you have mapped to the correct field ownerId.

Best Regards,
Sandhya