Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

No Other Query options supported when SavedQuery or UserQuery or FetchXml option is provided.

Posted on by 240

Hello All,

I am try to access the Entity records using the Web api and Datatables,Using noraml web api  ,DataTables.js  and ADAL.js ,Please find the following code,its throwing following error 500,

    var fetchxml = "<fetch mapping='logical' page='2' count='10' returntotalrecordcount='true' pagingcookie='%253ccookie%2520page%253d%25221%2522%253e%253caccountid%2520last%253d%2522%257bB8A19CDD-88DF-E311-B8E5-6C3BE5A8B200%257d%2522%2520first%253d%2522%257b475B158C-541C-E511-80D3-3863BB347BA8%257d%2522%2520%252f%253e%253c%252fcookie%253e'>" +
"  <entity name='account' >" +
"    <attribute name='address1_city' />" +
"    <attribute name='name' />" +
"  </entity>" +
"</fetch>";
 
 
            $("#example").DataTable({
                "processing": true,
                "serverSide": true,
                "aoColumnDefs": [
{ bSortable: true, aTargets: [0] },
{ bSortable: false, aTargets: ['_all'] }
                ],
                "ajax":
                    {
                        url: encodeURI(organizationURI + "/api/data/v9.0/accounts?fetchXml=" + fetchxml),
                        dataType: 'application/json',
                        method: 'GET',
                        'beforeSend': function (request) {
                            request.setRequestHeader("Authorization", "Bearer " + token);
                        },
                        data: function (d) {
                            return d;
                        },
 
                    },
                columns: [
        { title: "Name" },
        { title: "City" },
 
                ]
            });

One more question,passing of bearer in Datables.

Thank,

*This post is locked for comments

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: No Other Query options supported when SavedQuery or UserQuery or FetchXml option is provided.

    Hi Sairam,

    Basically this error means you cannot set any other option when using fetchxml. It seems along with fetchxml, you are also passing using something else. You can use fiddler or developer tool (network) to see the request which is building and identify what is it adding. You can also use Postman to confirm you implementation before actualy trying it oin code.

    docs.microsoft.com/.../use-postman-web-api

    Hope this helps.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans