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
Olivier CrivelliOlivier Crivelli 

Cannot get data from custom object using .NET API (QueryAsync)

Hi there,
I've created a custom object (Event) and try to get data using QueryAsync .Net API. When I execute the query into the developper console, I got the right result with all the fields populated
SELECT ID, Name, ABI201504__Release__c, ABI201504__EventName__c, ABI201504__CityName__c, ABI201504__StartDate__c, ABI201504__EndDate__c FROM ABI201504__Event__c

In my C# code I do the same

            // Populate List of Event
            String EventQuery = String.Format("SELECT ID, Name, {0}, {1}, {2}, {3}, {4} FROM {5}",
                Utilities.getAPIFieldName("Release"),
                Utilities.getAPIFieldName("EventName"),
                Utilities.getAPIFieldName("CityName"),
                Utilities.getAPIFieldName("StartDate"),
                Utilities.getAPIFieldName("EndDate"),
                Utilities.getAPIFieldName("Event"));
            List<Event> eventList = new List<Event>();
            var results = await forceClient.QueryAsync<Event>(EventQuery);

In the "results" var I got the number of records I expected, but only the "ID" and "Name" field contain Data, the other fields (customs) are empty. Did I miss something? Any Idea?
Thanks in advance for your help
Olivier
Daniel BallingerDaniel Ballinger
Is it possible there is a mix up between your custom ABI201504__Event__c sObject and the built in Event object.

If the query is actually over the inbuilt Event object or QueryAsync is using a representation of the inbuilt Event object then the custom fields wouldn't be applicable. It might be that the Force.COM .NET Toolkit returns the empty string rather than an error in these cases.