Share via


Virtual Entities - Relationships

In my post Virtual Entities I walked through the steps of creating a Virtual Entity using the data source "https://services.odata.org/V4/OData/OData.svc"

Another open data source is "https://api.purdue.io/odata" (publicly accessible), which lets us leverage a 1:n relationship that exists between (course-) subjects and courses in that provider to create and relate two virtual entities.

So if I create a parent (virtual) entity called CourseSubject and a related (virtual) entity called Course I can demostrate another aspect of the power of virtual entities - relationships

 

If I click CourseSubjects in the sitemap above I see all the (course-) subjects listed in a nice grid...

 

 

I can click one of the subjects, eg "American Studies" to open the form...

 

 

In the form, I can navigate to the related  views to see the all the Courses related to the subject American Studies...

 

 

In the list of courses related to subject American Studies I can click a Course...

 

 

And in the opened form I can see the lookup field from the relationship with the Subject

 

 

To make this work it is important you ensure that the external name of the lookup field matches the external name from the data source entity

 

 

The external name of the Lookup field is found in the data source xml

 

 

With Virtual Entities you can surface data from external data sources in Dynamics 365 and work with the data as entities without the data residing in Dynamics 365

Enjoy

See Also

  • Download the unmanaged solution here
  • List of Odata public APIs can be found here (filter by V4)

Comments

  • Anonymous
    November 11, 2017
    Super post. Really appreciated.
  • Anonymous
    November 17, 2017
    Is it possible to create a relationship between a "native", lets say Contact, and a "virtual" entity. Exactly the same scenario but using Contact instead of CourseSubject?I tried to do it and I'm getting an error right now.
  • Anonymous
    November 19, 2017
    Hi @Jesper, One of the important thing that we are looking for is the ability to search from parent record(Normal) by filtering from child(Virtual) records. i.e: Let's say we have an Account Entity (Normal) and Related list of Courses (Virtual). These two have 1: N relationship. We would like to do an advanced find to get a list of Account records whare Course expired on a certain date. I believe above scenario is not possible with the Virtual entity.