Introduction
In this article we are going to discuss how we can configure Dynamics 365 portal Web Roles and entity permission to access entity data based on the system N:N relationship. We are using Dynamics 365 trial and provisioned portal trial. Please refer our earlier article for setting up Dynamics 365 trial if you want to setup a Dynamics 365 trial and you can refer this KB to provision portal in your trial.
Requirement
Let’s say we have setup following custom N:N relationship between Account and Contact, so that multiple partner contacts can be associated to partner account and similarly partner account can be connected to multiple partner contacts.
Now we need to configure entity permission so that current portal user (partner contact) can access all the associated partner accounts where he is either primary contact or a partner contact.
Solution
We can create a new web role or can use 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 name field and select your portal website, keep other field as default and hit Save.
Once it is saved click on V sign next to Partner Portal User web role and select entity permissions
Click on New button to add entity permissions
Fill entity permission form like following and click on Save and Close, here we are using Contact scope and selecting our N:N relationship under Contact relationship.
Similarly we can setup another entity permission to allow access partner account based on the primary contact relationship like following
Now let’s say we have added a portal user, Please refer our earlier article to add quick portal user. Once contact is added we need to assign our web role to this portal user. Open contact and click on V sign and select Web Roles. Add our portal user web role by clicking on Add Existing Web Role.
Add this contact to any existing account as primary contact or create new account and set this contact as primary contact. Now when we navigate to portal with this new contact, we will be able to see one Account based on the primary contact relationship like following.
Let’s go back to Dynamics 365 CE and open any Existing Account, let say Adventure Works associate current portal user to this account using N:N relationship. Now when we will go back to portal, we should be able to see two Customers like following.
So this way we can configure entity permissions for 1:N and N:N relationship for Portal. Stay tuned for more Dynamics 365 Contents !!