Access Entity Based On N:N Relationship For Dynamics 365 Portal

Introduction

In this article, we are going to discuss how we can configure Dynamics 365 portal Web Roles and entity permission to access the entity data based on the system's N: N relationship. We are using the Dynamics 365 trial and provisioned portal trial. Please refer to my earlier article for setting up Dynamics 365 trial if you want to set up a Dynamics 365 trial. Also, you can refer to this KB to provision the portal in your trial.

Requirement

Let’s say we have set up the following custom N: N relationship between Account and Contact so that multiple partner contacts can be associated with the partner account and similarly partner account can be connected to multiple partner contacts.

 Partner account

Now, we need to configure the entity permission so that the current portal user (partner contact) can access all the associated partner accounts where he is either a primary contact or a partner contact.

Solution

We can create a new web role or can use an existing web role to set entity permissions. Let’s create a new web role, navigate to Portal->Web Roles, and Click on New.

Let’s use “Partner Portal User” under the name field and select your portal website, keep other fields as default, and hit Save.

Partner Portal User

Once it is saved, click on the V sign next to the Partner Portal User web role and select entity permissions.

Entity permissions

Click on the New button to add entity permissions.

New button

Fill entity permission form like the following and click on Save and Close, here we are using Contact scope and selecting our N: N relationship under Contact relationship.

Contact scope

Similarly, we can set up another entity permission to allow access to partner accounts based on the primary contact relationship like the following.

Dynamics

Now, let’s say we have added a portal user, Please refer our earlier article to add a quick portal user. Once contact is added we need to assign our web role to this portal user. Open Contact click on the V sign and select Web Roles. Add your portal user web role by clicking on it.

Add Existing Web Role

 Web Role

Add this Contact to an existing account as a primary contact or create a new account and set this contact as the primary contact. Now, when we navigate to the portal with this new contact, we will be able to see one Account based on the primary contact relationship like the following.

Customer Account

Let’s go back to Dynamics 365 CE and open any Existing Account, let say Adventure Works associates the current portal user to this account using the N: N relationship. Now when we go back to the portal, we should be able to see two Customers like the following.

 Adventure Works

So this way we can configure entity permissions for 1:N and N: N relationships for Portal. Stay tuned for more Dynamics 365 Contents!


Similar Articles
HIMBAP
We are expert in Microsoft Power Platform.