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

Community site session details

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

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
    738 Super User 2025 Season 2 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/
  • CU26111754-0 Profile Picture
    30 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. 
  • Suggested answer
    Fubar Profile Picture
    8,319 Super User 2025 Season 2 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..

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 66

#2
Fubar Profile Picture

Fubar 47 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard