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

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on at
    RE: Fetch xml query

    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"]

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Fetch xml query

    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
    Pawar Pravin  Profile Picture
    5,237 on at
    RE: Fetch xml query

    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
    Guido Preite Profile Picture
    54,077 Moderator on at
    RE: Fetch xml query

    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/

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 Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans