cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TonyBalogh
New Member

Virtual Entity relationships

Short form: how do I create a relationship between two virtual entities with custom data providers that I authored so I can use them in subgrids related to each other?

 

Goal:

I want to create a subgrid view on a contact form that displays a list from VE1 (call it personal accounts). When clicking on a personal account, I want to view the activity (VE2) related to the selected personal account on a subgrid found on the personal account form.

 

Where am I:

- I have two data sources, each with their own providers for one virtual entity.

- I have the relationship defined between contacts and personal accounts

- I have the contact form modified to show the personal accounts in a subgrid using the RetrieveMultiple handler for this entity. This works beautifully.

- When clicking on the personal account, the form will load with details loaded.

 

What's Not Working:

  • I cannot create a relationship between VE1 and VE2. I either get one of two errors:
    • "Message: Relationship between entities [VE1]and [VE2] is not allowed as they have different data sources" when setting up the 1:N or N:1 relationship in the classic editor
      • Unless I am mistaken, I cannot create a data source with multiple data providers. I don't understand this error message.VE - Classic Editor cascade settings.png
    • In the Power App solution editor, I get "The entity could not be updated: For Relationships referencing Virtual Entites, Cascade link type must be No Cascade"
      • With this attempt, I have tried to set the advanced options for this relationship to Custom, and set Restrict for delete and No Cascade for all others. When I reopen the relationship, it resets this to Referential behavior and Restrict for delete.
         

         

        VE - Advanced Settings reset.png

To me, I feel like I need this relationship to be present so that the subgrid can show associated records using the IDs from the virtual entities. Without this, the context doesn't have any concept of what record it is supposed to be associated with. How do I create a relationship between the two virtual entities so that the subgrid data shows correctly?

 

Thanks in advance!

1 REPLY 1
MarkData8
Advocate I
Advocate I

It's one of the documented restrictions of virtual entities that you cannot have entities from two different providers in the same query. I assume the restriction that you can't create a relationship between two different providers is related to this. Is it possible for you to create a single provider that works for both entities?

 

Virtual entities are also read-only, so there should be no need to set cascading options on its relationships as you won't be able to make any changes to the records to cascade.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,251)