web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

retrievemultiple issue

(0) ShareShare
ReportReport
Posted on by 7,316

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

  • Bruno Lucas Profile Picture
    5,421 on at

    Hi,

    Was there any change on the "codeFilter"

    Does the missing record contain a value for the missing column or is it a "null"

    What version of CRM server and SDK are you using?

    Is this on-premises CRM? can you run a sql profiler to see the t-sql generated?

  • Community Member Profile Picture
    on at

    Hi,

    Please check your criteria. It is modified?

    Mansoor

  • Aileen Gusni Profile Picture
    44,524 on at

    Menoo,

    When you said, 7 columns, only getting 6 columns, is for all of the record? And what is the  missing 1?

    THanks.

  • meenoo Profile Picture
    7,316 on at

    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

  • Aileen Gusni Profile Picture
    44,524 on at

    Meeno,

    This is not plugin?

    This is custom app?

    Okay, let's try to show all columns:

    ColumnSet = new ColumnSet(true)

    Thanks.

  • meenoo Profile Picture
    7,316 on at

    Its a custom app.

    Okay, I gave a try like ColumnSet(true) and the email column is still missing.

  • Aileen Gusni Profile Picture
    44,524 on at

    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.

  • Suggested answer
    Hugo Silva Profile Picture
    1,374 on at

    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 Profile Picture
    7,316 on at

    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.

  • Verified answer
    Aileen Gusni Profile Picture
    44,524 on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans