You need to sign in to do that
Don't have an account?
mahendran 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
);
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
);
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