Topic by Alan Meng
Content
Hi,
I have written the following C# (WCF) code to query Organization. The results return the correct organization record queried using the ID. But the Organization's CustomFields value is rendered as NULL in the result.
Just to test if the Connect service is returning data correctly , I also added a new file attachment and executed the code again. I am able to see the value for file attachment and all other standard fields but the CustomField object is still NULL.
Please help diagnose this issue.:-
// *** section: Query Organization using Connect SOAP -- *****************
ClientInfoHeader clientInfoHeader = new ClientInfoHeader();
clientInfoHeader.AppID = "Basic Query";
string QueryString = ("SELECT Organization FROM Organization O WHERE O.ID = " + 71 + ";");
Organization orgTemplate = new Organization();
RNObject[] objectTemplates = new RNObject[] { orgTemplate };
QueryResultData[] queryObjects = _client.QueryObjects(clientInfoHeader, QueryString, objectTemplates, 10000);
RNObject[] rnObjects = queryObjects[0].RNObjectsResult;
System.Console.WriteLine("rnObjects retreival successful");
Organization CustOrg = new Organization();
CustOrg = (Organization)rnObjects[0];
System.Console.WriteLine(CustOrg.Name); // This correctly returns the Organization record's Name properly.
GenericObject org_customFieldsc = new GenericObject();
org_customFieldsc = CustOrg.CustomFields;
// The problem is here where the CustOrg.CustomFields value is NULL in the result set.
System.Console.WriteLine("");