Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

RetriveMultiple not retrieving all the column values

(0) ShareShare
ReportReport
Posted on by 395

Hi,

I am trying to retrieve the data using RetrieveMultiple method. I am able to retrieve all the columns except one date time filed that one of our team mate created. Can you please confirm whether we need to apply any null conditions at the time of retrieving the data in case date field contains null values in system? If so how can we do that? I just wrote a simple straight forward query to retrieve the data I can see most of the columns except one date field that I need the value of.

QueryExpression qe = new QueryExpression();
qe.EntityName = "opportunity";
if (Columns == null)
qe.ColumnSet = new ColumnSet(true);
else
qe.ColumnSet = new ColumnSet(Columns);
qe.PageInfo.PagingCookie = "";
qe.PageInfo.PageNumber = PageNum;
qe.PageInfo.Count = 2500;
_service.RetrieveMultiple(qe);

*This post is locked for comments

  • Srini20 Profile Picture
    Srini20 395 on at
    RE: RetriveMultiple not retrieving all the column values

    Thanks Madhan & Alex. My column already exist in column list and also I tried to query entire entity but couldn't find the columns related to null. I  just figured that column will not be in the result set if that contains null value.

    Thank you for quick response.

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: RetriveMultiple not retrieving all the column values

    Hi,

     as Madhan suggested, that column name might be missing from the Columns variable.

     Another alternative - even though you might be passing all column names to the columnSet, if the field is not, actually, populated, you won't find it in the attributes of the record. In other words,

     entity["new_fieldname"]

    will throw an exception if, for that particular record, new_fieldname attribute has not been populated. You can check if the attribute is there by calling entity.Contains("new_fieldname")

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: RetriveMultiple not retrieving all the column values

    Please add the list of columns to your query expression as shown below. 

       QueryExpression qe = new QueryExpression();

       qe.EntityName = "opportunity";

       if (Columns == null)

        qe.ColumnSet = new ColumnSet(true);

       qe.ColumnSet.Columns.Add("name");

        qe.ColumnSet.Columns.Add("nameofothercolumn1");

       qe.ColumnSet.Columns.Add("nameofothercolumn1");

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans