Anytime, I try to loop the WebAPI(Json result), I always get the first value in the api printed the number of count of the result.
If I have 50 results in the Web Api query the first company(eg. ABC Corp) will be printed 50x.
Here is a sample code below, I am using to test from https://github.com/davidyack/Xrm.Tools.CRMWebAPI/tree/master/dotnet:
string fetchXml = "<fetch mapping='logical'><entity name='account'><attribute name='accountid'/><attribute name='name'/></entity></fetch>"; var fetchResults = await api .Result.Item2.GetList("accounts", QueryOptions: new CRMGetListOptions() { FetchXml = fetchXml }); foreach (var record in fetchResults.List){ foreach (var account in record){ _accountRecord.accountIdNumber = account.Value.ToString(); _account.Add(_accountRecord); } }
I would like to be able to pint out each company/account name our DynamicsCrmOnline.
Thank you in advance,
*This post is locked for comments
André Arnaud de Cal...
291,979
Super User 2025 Season 1
Martin Dráb
230,848
Most Valuable Professional
nmaenpaa
101,156