We recently got the below error in one of our cloud flows, the requirement was to fetch the distinct work orders that have notes with attachments associated with them.
A resource of type ‘Microsoft.Dynamics.CRM.annotation’ was found in a resource set that otherwise has entries of type Microsoft.Dynamics.CRM.msdyn_workorder’. In OData, all entries in a resource set must have a common base type.
This occurs if we try using the aggeration in the Fetch XML queries in the List rows action.
The solution was to rewrite the fetch xml query without using aggregation.
And then next if we want to get the distinct values, we can use the Union function for that.
Here,
we are first adding the GUIDs to the varLstWorkOrderGUID array variable using Append to array variable action
And then applying the Union function – to remove the duplicate from the array.
union(variables(‘varLstWorkOrderGUID’), variables(‘varLstWorkOrderGUID’))
The result –
More on Fetch XML Query
Hope it helps..
One thought on “Using Union function to remove duplicates – Power Automate / Dataverse”