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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Fetch XML not working

(0) ShareShare
ReportReport
Posted on by 111

Hi Experts,

I want to filter subGrid result but gettign query builder error

I copied the XML from Advanced find

PFB Code, kindly cross check FetchXML

function filterAssignedResourceGrid(executionContext) {
    var formContext = executionContext.getFormContext();
    var gridContext = formContext.getControl("availablebookableresource");
    if (gridContext == null) {
        setTimeout(function () {
            FetchViaName(executionContext);
        }, 2000);
        return;
    } else {
        debugger;
        var roleID = Xrm.Page.getAttribute("new_ptojecttask").getValue()[0].id
        if (roleID != null) {
            var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
                "  <entity name='msdyn_projectteam'>" +
                "    <attribute name='msdyn_projectteamid' />" +
                "    <link-entity name='bookableresource' from='bookableresourceid' to='msdyn_bookableresourceid' visible='true' link-type='outer' alias='a'>" +
                "      <attribute name='name' />" +
                "    </link-entity>" +
                "    <link-entity name='msdyn_resourceassignment' from='msdyn_projectteamid' to='msdyn_projectteamid' link-type='inner' alias='b'>" +
                "      <filter type='and'>" +
                "        <condition attribute='msdyn_taskid' operator='eq' uiname='qwerty 1' uitype='msdyn_projecttask' value='{9B069346-DE61-EA11-A811-000D3A5AC0B3}' />" +
                "      </filter>" +
                "    </link-entity>" +
                "  </entity>" +
                "</fetch>";
            gridContext.setFilterXml(fetchXml);
            gridContext.refresh();
        }
    }
}

I have the same question (0)
  • meelamri Profile Picture
    13,216 User Group Leader on at

    Hi, 

    Can you please share your subgrid config in your form

  • Filipe Lopes Profile Picture
    on at

    Hello Ahtesham. 

    Hope you are doing well. 

    It would be great if you could provide a bit more context on this issue. 

    A print screen of the image of the error and maybe log file if available to download, would maybe help to gather more information. 

    On the first look the code seems to be fine, I would like to point out that Xrm.Page has been deprecated and you should use FormContext. 

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/getattribute

    Query Builder Error usually occurs when FetchXml query is incorrect.

    Thank you for using Microsoft Dynamics 365 Communities,

    Dynamics CRM Support Blog

    Filipe Lopes

    Support Engineer

    Microsoft Dynamics 365

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 58 Most Valuable Professional

#2
#ManoVerse Profile Picture

#ManoVerse 42

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans