Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : DTPB/NAlJwQ5DPk2RlWKYP
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

using FetchXML to get the values of Global Choices dropdown fields

Like (0) ShareShare
ReportReport
Posted on 29 Jan 2021 19:19:48 by 35

Hi,

I'm using SSRS for creating reports but missing how you pull the data from Choice lookups.

For example I have this field  <attribute name="cr4fe_servicepaymentterms" />  in my fetchxml, but it is just returning the ID, not the text of the lookup.

thanks

  • Hitesh Nagpal Profile Picture
    5 on 15 Feb 2023 at 12:35:36
    RE: using FetchXML to get the values of Global Choices dropdown fields

    Hello, I was also stucked in this common problem, I was using dataverse, for me what worked is below syntax while displaying the values

    for choice field - logicalname.label (here using .value will give you id of the choice)

    for lookup field - logicalname.name ( in my case I needed name, you can try other column here)

    Thanks,

    Hitesh

  • dvcooper Profile Picture
    35 on 31 Jan 2021 at 15:11:05
    RE: using FetchXML to get the values of Global Choices dropdown fields

    Thanks Pablo,

    This answered my question in a round about way : )

    I'm using XrmToolbox to build my query string, however, what I noticed is that the results in XrmToolbox give me the quid value not the lookup value. so when i do this query in toolbox:

    <fetch>
    <entity name="opportunity" >
    <attribute name="ownerid" />
    <attribute name="owneridname" />
    <attribute name="cr4fe_koboldservice" />
    </entity>
    </fetch>

    I only get these results

    pastedimage1612105568809v1.png

    But when I run the same query in visual studio, I get both the guid and the lookup text as expected. 

    Thanks again for your response.

  • Verified answer
    PabloCRP Profile Picture
    1,088 on 31 Jan 2021 at 07:51:10
    RE: using FetchXML to get the values of Global Choices dropdown fields

    Hi dvcooper,

    Indeed when you retrieve a lookup value with FetchXml you'll get a GUID value.

    Making a link entity and get the name will work.

    But as you are using SSRS notice that 3 field are adding to your DataSet. So pick just cr4fe_servicepaymentterms

    cr4fe_servicepaymentterms LOOKUP's TEXT e.g: FOO
    cr4fe_servicepaymenttermsValue LOOKUP's GUID e.g: 319e2387-38b1-4200-91bb-3bb5410a4a3a
    cr4fe_servicepaymenttermsEntityName LOOKUP's EntityName e.g: cr4fe_servicepaymentterms
    please consider marking as an answer if it was helpful
  • Suggested answer
    prt33k Profile Picture
    6,907 on 31 Jan 2021 at 00:40:25
    RE: using FetchXML to get the values of Global Choices dropdown fields

    Hi David,

    You will not get the name field directly in fetchxml.

    You need to outer join the link entity and select the primary attribute from this entity.

    You can go to advanced find and then select the column you want into display column and then download the fetch..

    An example to show accountnumber from contact having account lookup as company name:

    pastedimage1612053457411v1.png

    <link-entity name="account" from="accountid" to="parentcustomerid" visible="false" link-type="outer" alias="a_c">
    <attribute name="accountnumber"/>

    Thanks,

    Prateek

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,337 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans
Loading started
Loading complete