FetchXML in PowerApps portal (Part 2)

Introduction: In this blog, we will see how we can access related entity data(linked entity attributes) of FetchXML in PowerApps Portal.

In part 1, we saw how we can access data of different data types.

Implementation

  1. Create your FetchXML query and download it.

Example:

{% fetchxml caseData %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
  <entity name="account">
    <attribute name="name" />
    <attribute name="primarycontactid" />
    <attribute name="telephone1" />
    <attribute name="accountid" />
    <order attribute="name" descending="false" />
    <filter type="and">
      <condition attribute="accountid" operator="eq" value="{475B158C-541C-E511-80D3-3863BB347BA8}" />
    </filter>
    <link-entity name="incident" from="customerid" to="accountid" link-type="inner" alias="aq">
      <attribute name="primarycontactid" />
      <attribute name="title" />
      <attribute name="prioritycode" />
      <filter type="and">
        <condition attribute="casetypecode" operator="eq" value="1" />
      </filter>
    </link-entity>
  </entity>
</fetch>
{% endfetchxml %}

{% for result in caseData.results.entities %}
     Case Title: {{result['aq.title']}} </br>
     Case Type: {{result.['aq.prioritycode'].label}} </br>
     Contact Id: {{result.['aq.primarycontactid'].id}} </br>
     Contact Name: {{result.['aq.primarycontactid'].name}} </br>
{% endfor %}

Explanation:

  • To access case title we use: {{result[‘aq.title’]}}

Here ‘aq’ is the alias name in fetchXml and title is the column name.

  • To access option set we use: {{result.[‘aq.prioritycode’].label}}
  1. Add the above liquid code on the webpage where you want to display the result.
  1. Once you are done, Click on Browse website.
  1. You can see the result on the webpage

NOTE:

  1. User should have permission to access the data

Leave a Reply

Your email address will not be published. Required fields are marked *