cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

How to create an Entities List which will take fields from multiple entities in Power App Portal

Hi Experts,

I am new to Power APP and trying to create a Power App Portal. Below is my requirement:

 

I am trying to create an Entity List in Portal which should have fields from multiple Entities according to the relationship between Entities. below is a scenario:

 

I have a local authentication and all the user contact records are available in Contacts Entities. Now there are other Entitie from which I have to filter the data on the basis of the logged-in users. For that I have created a Field in one Entities and If I  create a View in that Entities and use that as an Entity List in Portal then working fine but I want to add other fields from other entities also.

how to include other fields from different entities in that view?

 

Below are the Entities in My CDS:

1. Contacts: Used for local authentication.

2. Entities 1: Store the basic user details. (Name_ID as PK)

3. Entities 2: Store detailed data of User.  (Name_ID as PK)

4. Entities 3: Store the other detailed data of User.  (Name_ID as PK)

 

Relationship between Entities 1, 2 & 3 are on Name_ID

Currently, I have established a relationship between Contacts and Entities 1 by using a lookup for Contact. So, if I create a view in Entities 1 then the data is filtering only for logged in user.

 

Basically I want to create an Entity List in a portal that will have the data coming from all the 3 Entities for logged-in user.

 

Please help me with this requirement.

 

Thanks,

Amit

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Sage
Solution Sage

Re: How to create an Entities List which will take fields from multiple entities in Power App Portal

Hi @AmitSah ,

 

You can show fields from related entities in the view, but only the one that has direct relationships. For example, you have Contact entity and on the Contact you have lookups to Entity 1, Entity 2 and Entity 3. Then in the view for the Contact you can include fields from all of those entities.

If you want to utilize your existing 1:n relationship and don't create lookups on the Contact and only want to show fields from multiple entities in some sort of table or grid you can achieve this with fetchxml. All you need to do is create a query that will fetch all necessary info and will return it to you in json format and then use a library like datatables to show the data. You can find good articles (first and second) from Colin Vermander on how you can fetch data that way.

 

Hope this will help.

----------------------------------------------------
If you find this post helpful consider marking it as a solution to help others find it.

View solution in original post

3 REPLIES 3
Highlighted
Solution Sage
Solution Sage

Re: How to create an Entities List which will take fields from multiple entities in Power App Portal

Hi @AmitSah ,

 

You can show fields from related entities in the view, but only the one that has direct relationships. For example, you have Contact entity and on the Contact you have lookups to Entity 1, Entity 2 and Entity 3. Then in the view for the Contact you can include fields from all of those entities.

If you want to utilize your existing 1:n relationship and don't create lookups on the Contact and only want to show fields from multiple entities in some sort of table or grid you can achieve this with fetchxml. All you need to do is create a query that will fetch all necessary info and will return it to you in json format and then use a library like datatables to show the data. You can find good articles (first and second) from Colin Vermander on how you can fetch data that way.

 

Hope this will help.

----------------------------------------------------
If you find this post helpful consider marking it as a solution to help others find it.

View solution in original post

Helper III
Helper III

Re: How to create an Entities List which will take fields from multiple entities in Power App Portal

Hi @OOlashyn 

Thanks for the response!

So, As per your first point If I have to create a Entitie List in a portal (intern View inside an Entities) whose Fields need to come from multiple Entities then I have to create a direct relationship using lookup data type?

So, In my case, Entity 1, Entity 2 and Entity 3 are my main Entities where user detailed information is saved.

Earlier there was no relationship between those three Main Entities and Contact Entities. So, to filter the data from those 3 main Entities once the authenticated user logged-in, I have created a custom field in Entitie 1 and made a direct relationship with Contact using a lookup. So, my Entitie 1 data is filtering perfectly for a specific logged-in user (created View inside the Entitie 1 and used that in the portal as a Entity List). But to filter the data in Entity 2 and Entity 3 and include the fields from these Entities I have to create another two fields which will have a direct relationship with Contact? Because in normal SQL If I have established a relationship then I can get the data from different tables but in this case If I have established a relationship (the relationship tab inside the Entities) between Entities then also I have to create a direct relationship using lookup data type.

 

Could you please suggest me on this? because I have to create an Entity Form also where the user can insert the data to multiple Entities and I have to include different fields coming from Multiple Entities. and I think currently with Liquid code also we can't write back the data to Entities (If I am not wrong).

 

Also regarding the 2nd option I will have a look into that.

 

Thanks,

Amit

Highlighted
Solution Sage
Solution Sage

Re: How to create an Entities List which will take fields from multiple entities in Power App Portal

Hi @AmitSah ,

 

Entity Lists on the Portals are based on the views. And views allow you to show the fields from the target entity and any directly related entity. As per MS docs: "You can include columns from the current entity or any of the related entities that have a 1:N entity relationship with the current entity."

Entity Lists are used to show the data, not for setting it.

Similarly to SQL you can retrieve data from related entities in the fetchxml but only to display them in the read-only form.

Regarding insert - if you need to insert data in the multiple entities in some sort of sequence you can do it with Web Forms. They allow you to create a multi-step process where each step can be a different entity that you can create or edit. Also, they allow you to define some conditional logic. You can find official docs here and also can check out a short video from Nicholas Hayduk. I think this option should help you.

----------------------------------------------------
If you find this post helpful consider marking it as a solution to help others find it.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (12,508)