cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OkayGoogle
Helper II
Helper II

Associate custom entity with the Account entity so that it would show up in Power Apps Portal

This is probably a beginner question but I'm having trouble getting this to work.

 

SCENARIO:

I have a table (entity) in Dataverse (Common Data Service) called Inventory.

 

Inventory

ItemAvailableCustomer
Ball25SomeMart
Screwdriver67Reliable Hardware

 

Then in my Power Apps Portal (which is based on the Dynamics 365 Customer Portal template), I have "users" (Contacts) that are associated with "customers" (Accounts). I currently have Orders showing up based on the Account correctly, but that was preconfigured in the Dynamics 365 Customer Portal template.

 

GOAL

In my portal, based on which Account the authenticated Contact is associated with, I only want the Contact to see their associated inventory.

Let's say we have a user named Okay Google. Okay Google is associated with Reliable Hardware. So when Okay Google logs in and goes to the Inventory page in the portal, they should only see inventory for the customer named Reliable Hardware.

 

What I have tried

I created the following relationships in Dataverse on my Inventory table:

  • Inventory many to one Account relationship
  • Inventory many to one Contact relationship
  • Inventory many to one Company relationship

Then I made an entity permission for the Inventory entity:

  • Using the Account relationship (didn't work)
  • Using the Contact relationship (didn't work)
  • Using the Company relationship (didn't work)

What "didn't work" means:

When I go into my inventory page when logged in as Okay Google who is associated with customer Reliable Hardware, I don't see any inventory at all. It says there is no data.

 

Please help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Fubar
Solution Sage
Solution Sage

For the Entity Permissions to work, it is expecting that on your Inventory records that the Lookup field (looking up Account) is populated.

And that the Portal User, is a Contact for that Account.

 

When creating the DataVerse records populate the fields appropriately (e.g. make the Account on the Inventory record mandatory etc).  If populating from the Portal there are ways to achieve this usually by using Metadata against he Entity Form (where you can populate the Account lookup etc).

 

View solution in original post

8 REPLIES 8
OOlashyn
Super User
Super User

Hi @OkayGoogle,

Can you provide a bit more details: what are you using to show the data - entity list or some custom fetching solution? If this is an entity list can you tell us what views are you using there and if entity permissions are enabled for it. Also, can you share entity permission that you configured and show to which web role they were associated?

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

Of course!

I am using an entity list with a view for All Customer Inventory.

OkayGoogle_0-1619125164890.png

 

The view works when I look at it in Dataverse; of course it's not filtered by customer so it shows all inventory for all customers. The customers are a Text column.

 

Entity permissions are already enabled:

OkayGoogle_1-1619125226880.png

 

The associated web roles are Authenticated Users and Customer Representatives. This is the one where I tried to associate it with the Account:

OkayGoogle_2-1619125539677.png

OkayGoogle_3-1619125576630.png

 

Let me know if I can clarify anything else.

It does look correct. However, I noticed that you say that Customer is a Text column. Can you confirm that Account column on Inventory table to which your relationship is pointing is a lookup and it is populated with the parent account of your contact?

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

Okay I think we may be getting to the problem.

 

Here is my table (it's a bit more complicated than my initial example). You can see that it has a lookup column to the account. The customer name is stored in the column called Customer Relation, which is a Text field.

 

OkayGoogle_0-1619127000985.png

Now here is the data in my view (note that the Item Relation column is just the item name):

 

OkayGoogle_1-1619127347060.png

 

 

The entire Account column is empty for some reason. How do I get my Customer Relation column to also show in my Account column, assuming that is what I need to do to get it to work.

Fubar
Solution Sage
Solution Sage

They need to be dataverse relationships e.g. 

For the 1:N relationships they need to be Lookups (on the entity on the N side of the 1:N) 

(for native N:N just defined as N:N relationship).

 

@Fubar Thanks Fubar, I am a bit confused because they indeed are Dataverse relationships. The Account column is a lookup if you see the picture below. Do I need to manually fill the Account column in with the Customer names?

OkayGoogle_0-1619131390908.png

Thanks again for your help!

Fubar
Solution Sage
Solution Sage

For the Entity Permissions to work, it is expecting that on your Inventory records that the Lookup field (looking up Account) is populated.

And that the Portal User, is a Contact for that Account.

 

When creating the DataVerse records populate the fields appropriately (e.g. make the Account on the Inventory record mandatory etc).  If populating from the Portal there are ways to achieve this usually by using Metadata against he Entity Form (where you can populate the Account lookup etc).

 

View solution in original post

Thank you for this explanation about what the portal is expecting. I could not find it anywhere in the documentation! I am actually using Dual Write to populate records, but now I know that I need to populate the account myself. My mistake was that I thought it would automatically notice there is a Customer column in my table and fill in the Account.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Users online (34,435)