Hi,
I am retrieving a column set using RetrieveMultiple. It used to work before correctly but then I changed some project settings in visual studio and reverted them back to old ones. Since then code started behaving differently.
QueryExpression query = new QueryExpression { EntityName = "new_name", ColumnSet = new ColumnSet(new string[] { "new_firstname", "new_lastname", "new_language", "new_email", "new_primaryphone", "new_type", "new_state" }), Criteria = codeFilter }; EntityCollection records = _orgService.RetrieveMultiple(query);
On execution 'query' has all the 7 columns but then after RetrieveMultiple execution only 6 columns are getting assigned to 'records' entity collection.
Why would that happen?
Thanks for any help!
*This post is locked for comments
Yep, Aileen, you have my vote for MVP.
You always do due diligence and get to the correct answer.
Keep up to good work, much appreciated.
If it is null, you cannnot retrieve the field value, that is what returned in the retrieve function in CRM.
Then you should validate whether its entity contains the attribute or not.
Aileen, so what if the field value is null and I want to retrieve that field also?
I think this is happening because field null values. When my code was working fine, I am sure there were no nulls. Now, I am testing with different scenarios and it is failing.
Hi Meenoo,
If this is a plugin you need to check if you done any filter criteria on the fields on the plugin register.
<Step CustomConfiguration="" Name="DoSomething_OnPostUpdate" Description="Post-Operation for DoSomething" FilteringAttributes="FieldsToBeFiltered" Id="000AAA0A-0000-A000-00A0-00000A000A00" MessageName="Update" Mode="Synchronous" PrimaryEntityName="SomeEntity" Rank="1" SecureConfiguration="" Stage="PostOutsideTransaction" SupportedDeployment="ServerOnly"> <Images> <Image Attributes="SomeEntity" EntityAlias="PreImage" Id="000AAA0A-0000-A000-00A0-00000A000A00" MessagePropertyName="Target" ImageType="PreImage" /> <Image Attributes="SomeEntity" EntityAlias="PostImage" Id="000AAA0A-0000-A000-00A0-00000A000A00" MessagePropertyName="Target" ImageType="PostImage" /> </Images> </Step>
Meenoo,
To be honest I have no idea about this except that the field values is really null.
Because CRM will only return the records attribute that consist value, so that otherwise got object reference error.
Especially you have did the column set to true, so it does mean we have already 'insist' the CRM to provide all of the possible fields, but if the value is blank then CRM wont be able to provide it to us.
Let's you try using the service.Retrieve() function, take an example.
Or try to use the FetchExpression, and also see using the odata query whether you got the email data or not.
Thanks.
Its a custom app.
Okay, I gave a try like ColumnSet(true) and the email column is still missing.
Meeno,
This is not plugin?
This is custom app?
Okay, let's try to show all columns:
ColumnSet = new ColumnSet(true)
Thanks.
Yes for all the records. And initially it is new_email that was missing. Then I took off that column and tried to execute it. Then another column is missing! I don't understand how to troubleshoot it.
Bruno Lucas The missing column does have value and it is not null. I am using CRM 2013 on prem. ANd I haven't changed anything in the filter.
Thanks
Menoo,
When you said, 7 columns, only getting 6 columns, is for all of the record? And what is the missing 1?
THanks.
Hi,
Please check your criteria. It is modified?
Mansoor
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156