Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

fetchxml - retrieve entity data with a global option list

  • 1.  fetchxml - retrieve entity data with a global option list

    Posted 14 days ago
    Hi I have an employee booking entity with the "reason for entry" field.
    For the Reason for Entry field i used global option set.
    i used the following fetchxml to retrieve the data to create a report. all the fields bring the data except the "reason for entry" field. how i can retrieve the value of "reason for entry" field which comes from the global option set in my case. thank you, Siva

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    <entity name="msft_employeebooking">
    <attribute name="createdon" />
    <attribute name="msft_employeeid" />
    <attribute name="msft_facilityid" />
    <attribute name="msft_bookingdate" />
    <attribute name="new_mangerfullname" />
    <attribute name="msft_employeebookingid" />
    <attribute name="new_reasonentry" />

    Siva Nama

  • 2.  RE: fetchxml - retrieve entity data with a global option list

    Posted 14 days ago

    Hi @Siva Nama
    I just tried on my contacts where blockedreason is a global option set. When using this FetchXML I get the results showing the option set value and the id. Use the Fetch XML tester in the XRM Toolbox to check your results. I assume you get the results but you would need to find the right way to show the name in your report instead of the ID. That would be a different question. In that case let me know in what program you build the report.

    Fetch XML:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    <entity name="contact">
    <attribute name="new_blockedreason" />
    <filter type="and">
    <condition attribute="new_blockedreason" operator="eq" value="3" />
    <new_blockedreason name="Deceased" formattedvalue="3">3</new_blockedreason>

    Axel Girgensohn
    Dynamics CRM Specialist
    Aller Media AB

  • 3.  RE: fetchxml - retrieve entity data with a global option list

    Posted 14 days ago
    Thank you for the information.
    i am using liquid template code in the Web template in Dynamics 365.

    I am not sure how did you get the value="3" in your example. i am trying to get all the employee bookings that were saved with the value of reason for the entry (global option list value). I wouldn't know what would be the value if i need to specify as you have specified in your example.

    i used fetchxml to query all employee booking data and try to display it as below.

    {% for empBooking in employeeBookings.results.entities %}
    <td>{{ empBooking.fullname }}</td>
    <td>{{ empBooking['fac.msft_name'] }}</td>
    <td>{{ empBooking.new_reasonentry }} </td>
    <td>{{ empBooking.new_reason }}</td>
    {% endfor %}

    The image for my report can be found from this link. Here you will notice the reason for the entry column is empty. This is a mandatory field. so values are available for these records. Somehow it is not showing. Please advise me on how I can display the value.

    this is the global option list fetch xml for the "reason for entry" dropdown
    {% fetchxml reasonEntries %}
    <fetch top="50" >
    <entity name="stringmap" >
    <attribute name="attributevalue" />
    <attribute name="attributename" />
    <attribute name="value" />
    <attribute name="stringmapid" />
    <filter type="and" >
    <condition attribute="attributename" operator="eq" value="new_reasonentry" />
    {% endfetchxml %}

    Thank you

    Siva Nama

  • 4.  RE: fetchxml - retrieve entity data with a global option list

    Posted 14 days ago
    it displayed the value of option list when i add "lable" to the attribute.
    <td>{{ empBooking.new_reasonentry.label }} </td>

    Siva Nama

If you've found this thread useful, dive deeper into User Group community content by role