Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Read results of fetchXML link-entity in ADX portal

Posted on by Microsoft Employee

<fetch distinct="false" mapping="logical" output-format="xml-platform" version="1.0">

<entity name="apitil_approval_record">

<attribute name="apitil_approval_recordid"/>

<attribute name="apitil_time"/>

<attribute name="apitil_comments"/>

<attribute name="apitil_approvalauthorization"/>

<attribute name="apitil_approver"/>

<attribute name="apitil_approvalstatus"/>

<order descending="false" attribute="apitil_approvalauthorization"/>

<filter type="and">

<condition attribute="apitil_approvercustomer" operator="not-null"/>

</filter>

<link-entity name="apitil_servicerequest" alias="a_c26da75a1e81e61180f1fc15b4282658" link-type="outer" visible="false" to="apitil_servicerequest" from="apitil_servicerequestid">

<attribute name="apitil_title"/>

<attribute name="apitil_description"/>

</link-entity>

</entity>

</fetch>

Above mentioned is my fetchXML i would like to read the apitil_title and apitil_description values.

I tried the following methods but could not get the value :

{% assign app_cust = approval_action_query.results.entities %}

{% for approver in app_cust %}  

{{entities.apitil_servicerequest[approver.apitil_description]}}{{entities.apitil_servicerequest[approver.apitil_description].name}} {{entities.apitil_servicerequest[approver.apitil_description].value}} {{entities.apitil_servicerequest[approver.apitil_description].id}}

{% endfor %}

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Read results of fetchXML link-entity in ADX portal

    Hi,

    How did you manage to display the link entities which consist of more than one items.
    I have this sample query to display on my custom page

    {% fetchxml my_query %}
      <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    	  <entity name="salesorder">
    		<all-attributes/>
    		<link-entity name="salesorderdetail" from="salesorderid" to="salesorderid" visible="true" link-type="inner" alias="orderalias">
    		  <attribute name="description"/>
    		</link-entity>
            <filter type="and" >
                <condition attribute="customerid" operator="eq" value="3855D45D-8DE7-E611-8102-C4346BC41FA4" />
            </filter>
    	  </entity>
    	</fetch>
    {% endfetchxml %}
    
    
    {% for result in my_query.results.entities %}
      Order Number: {{ result.ordernumber }} <br/> 
      {% for res in result['orderalias'] %}
    	  Product: {{ res.description }}<hr/>
      {% endfor %}
    {% endfor %}
    


    wherein the salesorderdetail may consist of more than one product. How do you manage to display it?What am I doin wrong in here?
    I was able to display the ordernumber but their link entity wasn't displaying.
    Thanks

  • Suggested answer
    Colin V Profile Picture
    Colin V on at
    RE: Read results of fetchXML link-entity in ADX portal

    Hi Kalpana, here is an example of accessing the linked entity attributes.  Key is using the attribute name with the alias defined in the link-entity fetch.

    {% fetchxml my_query %}
      <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    	  <entity name="incident">
    		<attribute name="title" />
    		<link-entity name="contact" from="contactid" to="customerid" visible="true" link-type="outer" alias="contactalias">
    		  <attribute name="lastname" />
    		</link-entity>
    	  </entity>
    	</fetch>
    {% endfetchxml %}
    
    {% for result in my_query.results.entities %}
      Case Title: {{ result.title }} <br/> Last Name: {{ result['contactalias.lastname'] }}<hr/>
    {% endfor %}


  • Suggested answer
    Nadeeja Bomiriya Profile Picture
    Nadeeja Bomiriya 6,804 on at
    RE: Read results of fetchXML link-entity in ADX portal

    Hi Kalpana,

    +1 for Andreas's suggestion.

    I would suggest following approach to debug this issue.

    Read through the threads Andreas supplied.

    Write a simple FetchXML query (i.e. returning one field, ideally a string) and see if you can get it to display.

    Make sure the entity permissions are configured correctly.

    Once you get one working gradually add more complex FetchXML queries and see if it works.

  • Suggested answer
    Andreas Cieslik Profile Picture
    Andreas Cieslik 9,265 on at
    RE: Read results of fetchXML link-entity in ADX portal

    Hi Kalpana,

    have you considered this post:

    community.dynamics.com/.../208006

    also mentioned here:

    community.adxstudio.com/.../68465eea-2806-e611-9407-000d3a10c65c

    Cheers,

    Andreas

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,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans