Tuesday, September 9, 2014

Odata Query to Retrieve Information from a self-reference Query

Using the expand term with CRM 2011 and 2013 Odata queries we can bring the related entities required field values. There is a limitation for 6 relationships.

E.x: -
If you want to retrieve the parent contact name when retrieving the accounts then you can easily use this.


However if you want to retrieve information from a self-reference this method would not work. Microsoft has mentioned this in the below link.

The conceptual schema definition language (CSDL)  element includes all the 1:N, and N:N relationships for the entity. If the relationship represents a self-referencing relationship, there will be two  elements for this relationship. The name of the relationship uses the prefix Referenced and Referencing to differentiate the role a specific record plays in the relationship. For more information, see Types of Entity Relationships.

An example of how this can achieved is given below. This has been written to the default account self reference.


No comments:

Post a Comment

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...