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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Fetch xml query

(0) ShareShare
ReportReport
Posted on by 1,703

CRM2016 on Premises

I have an xml query with an attribute new_service which is an option set. can I get that option set value within my fetch XML? 

<fetch top="50" >
  <entity name="account" >
    <attribute name="new_servicename" alias="service" />
    <attribute name="new_companyname" alias="companyname" />
    <attribute name="address1_composite" alias="address" />
  </entity>
</fetch>


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    yes, you can query optionsets

    if you want to build and test your fetchxml you can use this amazing tool FetchXML Builder for XrmToolBox

    http://fxb.xrmtoolbox.com/

  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at

    Hi PeteN,

    You can test your xml using using FetchXml builder or using CRM chrome extension. Please refer below url for reference:

    pravinpawarweb.wordpress.com/.../dynamics-crm-extension-for-developers-dynamics-crm-hudcrm-0-1-3-2

    http://fxb.xrmtoolbox.com/

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hello ,

    Have a look below reference  -

    From JS -

    mahadeomatre.blogspot.com/.../use-fetchxml-to-retrieve-data-from-ms.html

    From C# code -

    arunpotti.wordpress.com/.../fetch-xml

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on at

    Yes you can get option set value. Just use schema name "new_service". I have noticed that you are using "new_servicename". Please make sure correct name.

    If you are looking to retrieve Option set label then you have to use below line of code:

    string label=entity.FormattedValues["new_service"]

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans