I'm working on a custom web service for a CRM 2011 deployment, and I'm now making an overview which relates to some of our entities. We have a custom product
entity with details such as the product name and category, and we have an agreement
entity, which links the product
to the customer and contains product details specific to that customer. agreement
and product
have an N:1 relationship.
I'm now making an overview page that will be displayed on the customer page in CRM, which should display all agreement
s on that customer. For this display, I also need to retrieve some information about the product
s these agreements link to, which will be used to group the agreement
s on the overview page. I've been unable to find any relevant/specific examples on this, and I'm stuck trying to find a feasible way of querying for the data I need.
The way I imagine it, I would like to use two queries to get the required data. First, a query that gets all the agreement
s on the customer. Then pass this list to a second query, which returns all the product
s that intersect the first list. Is this possible using a QueryExpression
, or do I need to loop over the agreement
list and run a separate query for each individual association? I'd prefer to avoid FetchXML
if possible.