Hey guys
I've got a fetch query that I can't seem to get correct. I want to use this query outside of advanced find but I cant seem to get my desired results.
I want to get appointments where the regarding is either a contact with a business category of
100000034
100000018
or accounts where the business category is
100000034
100000018
so lets say I have 3 appointments where the regarding is a contact and 5 appointments where the regarding is an account: how do I get all 8 and only the 8. Using the fetchxml tester from the XrmToolBox I'm getting more than 20 which is wrong? Any help would be appreciated guys. Here's my fetch:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="appointment">
<attribute name="subject" />
<attribute name="statecode" />
<attribute name="scheduledstart" />
<attribute name="scheduledend" />
<attribute name="createdby" />
<attribute name="regardingobjectid" />
<attribute name="instancetypecode" />
<attribute name="activityid" />
<order attribute="subject" descending="false" />
<filter type="and">
<condition attribute="scheduledstart" operator="on-or-after" value="2019-04-30" />
<condition attribute="scheduledstart" operator="on-or-before" value="2020-05-30" />
</filter>
<link-entity name="account" from="accountid" to="regardingobjectid" link-type="outer" alias="ad">
<filter>
<condition attribute="exe_businesscategory" operator="in">
<value>100000034</value>
<value>100000018</value>
</condition>
</filter>
</link-entity>
<link-entity name="contact" from="contactid" to="regardingobjectid" link-type="outer" alias="ab">
<filter type="and">
<condition attribute="exe_businesscategory" operator="in">
<value>100000034</value>
<value>100000018</value>
</condition>
</filter>
</link-entity>
</entity>
</fetch>