Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

FetchXML Help - OR Across Entities

$
0
0

Using Advanced Find, I can search for Opportunities where the Opportunity Type is a particular value and an Opportunity Product in the Opportunity is a particular Opportunity Product.

 

<entity name="opportunity" >

<attribute name="name" />

<order attribute="name" descending="false" />

<filter type="and" >

<condition attribute=" opportunitytype" operator="eq" value="100000018" />

</filter>

<link-entity name="opportunityproduct" from="opportunityid" to="opportunityid" alias="af" >

<filter type="and" >

<condition attribute="productid" operator="in" >

<value uiname="some product name here" uitype="product" >{some product ID here}</value>

</condition>

</filter>

</link-entity>

</entity>

 

Great. But is there any way I can search for Opportunities where the Opportunity Type is a particular value OR an Opportunity Product in the Opportunity is a particular Opportunity Product?

 

I know you can't do it in Advanced Find, but I'm hoping you can with FetchXML.

 

I'm thinking of being able to specify the link-entity outside the filter block, and then later reference the link-entity by its alias, something like this (major changes in red):

 

<entity name="opportunity" >

<attribute name="name" />

<order attribute="name" descending="false" />

<link-entity name="opportunityproduct" from="opportunityid" to="opportunityid" alias="af" />

<filter type="or" >

<condition attribute=" opportunitytype" operator="eq" value="100000018" />

<condition attribute="af.productid" operator="in" >

<value uiname="some product name here" uitype="product" >{some product ID here}</value>

</condition>

</filter>

</entity>


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>