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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Fetch XML Query working in Toolbox Builder but not in Logic App

(0) ShareShare
ReportReport
Posted on by 5

Hello All,

I am trying to find duplicates for sharepoint document locations and therefore I am builiding a fetchxml Query to find all duplicates.

The list is quite large (25k) and therefore i need to filter the result again anyways but just "List rows" would exceed the 5k limit.

The Query looks as such:

<fetch aggregate="true" top="200" >
<entity name="sharepointdocumentlocation" >
<filter type="and" >
<condition attribute="regardingobjectid" operator="not-null" />
</filter>
<attribute name="regardingobjectid" groupby="true" alias="groupId" />
<attribute name="regardingobjectid" aggregate="count" alias="count" />
<order alias="count" descending="true" />
</entity>
</fetch>

The Query results in 89a table with the desired results when using XRM-Toolbox.

pastedimage1647953219535v1.png

But if i try to fetch via an http request in flow/logic app:

pastedimage1647953348388v3.png

I get the following Error Response:

 "code": "0x0","message": "An ODataPrimitiveValue was instantiated with a value of type 'Microsoft.Xrm.Sdk.EntityReference'. ODataPrimitiveValue can only wrap values which can be represented as primitive EDM types."

Does anybody have an idea how to fix this or how i can understand the error in this context.
The field I am grouping on is a lookup field where i use the id to group.
Thank you,
Felix
I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    we have to pass encoded fetch xml declared in variable in step above.

    For that click after = in URI and paste “uriComponent(variables(‘fetchxmltoexecute’))” in dynamics content section and click ok.

    vishalgrade.com/.../

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Felix Stuettgen Profile Picture
    5 on at

    Hello Kumar,

    Thanks for the reply.

    I have tried your solution:

    pastedimage1648114281415v1.png

    Unfortunately this did not change anything in the outcome.

    Any further ideas?

    Best, 

    Felix

  • Suggested answer
    Nya Profile Picture
    29,060 on at
  • Felix Stuettgen Profile Picture
    5 on at

    Hello Nya,

    Originally i wanted to use this tutorial but the authentification is more complicated and the http request should be the same afterwards right?

    But I will give it a try later on.

    Best regards, Felix

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 137 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 57

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans