web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / FetchXML with Web API ...
Power Pages
Suggested Answer

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

(1) ShareShare
ReportReport
Posted on by 30
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:
I have the same question (0)
  • bscarlavai33 Profile Picture
    752 Super User 2026 Season 1 on at
    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/
  • CU26111754-0 Profile Picture
    30 on at
    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. 
  • Suggested answer
    Fubar Profile Picture
    8,463 Super User 2026 Season 1 on at
    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..

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Pages

#1
Suriyanarayanan V Profile Picture

Suriyanarayanan V 45

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 14 Most Valuable Professional

#3
DP_Prabh Profile Picture

DP_Prabh 13

Last 30 days Overall leaderboard