Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
Suggested answer

FetchXML with Web API Fails When Using Multiple link-entity Elements

(1) ShareShare
ReportReport
Posted on by 24
I am using FetchXML queries with the Web API in Power Pages to retrieve data with multiple link-entity elements. According to the documentation, FetchXML supports up to 10 link-entity elements. However, when I include more than 1 link-entity in my FetchXML query, I receive a "Web API is not available" or similar error. The query works fine with a single link-entity, but adding more causes it to fail.
 
var fetchXml = `<fetch count="10" page="1" returntotalrecordcount="true">
  <entity name="primary_entity">
    <attribute name="recordid" />
    <link-entity name="related_entity_1" from="id" to="related_id_1" alias="alias1" link-type="outer">
      <attribute name="field1" />
    </link-entity>
    <link-entity name="related_entity_2" from="id" to="related_id_2" alias="alias2" link-type="outer">
      <attribute name="field2" />
    </link-entity>
  </entity>
</fetch>`;
$.ajax({
    type: "GET",
    url: "/_api/primary_entities?fetchXml=" + encodeURIComponent(fetchXml),
    success: function (res) {
        console.log(res);
    },
    error: function (xhr) {
        console.error(xhr.responseText);
    }
});

Here it works for when use one link-entity but for two it states web api is not available.

Is there a specific limitation when using multiple link-entity elements in FetchXML through the Web API?

Categories:
  • Suggested answer
    Fubar Profile Picture
    8,010 Super User 2025 Season 1 on at
    FetchXML with Web API Fails When Using Multiple link-entity Elements
    Not sure if this is the issue or not, but there is a known issue with complex queries when the system adds the extra pieces for the Table Permissions (i.e. it adjusts your query to add the permissions scope like account and contact scope).
     
    You can test this by setting table permissions to Global as global does not alter the query.
     
    My other thought would be that it may not like it as they are both Outer joins - but if thats the case may be more of a bug..
  • CU26111754-0 Profile Picture
    24 on at
    FetchXML with Web API Fails When Using Multiple link-entity Elements
    I have created the xml using fetchxmlbuilder. From this fetch if i remove one entity then its work fine. 
     
    Also the error “Web Api is not available” i encountered come when site settings is not available but in this i have ensure that they are created. 
  • bscarlavai33 Profile Picture
    608 Super User 2025 Season 1 on at
    FetchXML with Web API Fails When Using Multiple link-entity Elements
    That should be fine. Maybe there is some sort of syntax issue.
     
    Are you able to run your Fetch XML using XrmToolBox and see if it returns a result? https://www.xrmtoolbox.com/plugins/Cinteros.Xrm.FetchXmlBuilder/

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35