Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 64797

Role Based forms

$
0
0

In this blog, we will learn how to use Role based forms in Dynamics CRM and the best practices that should be followed when using Role based forms.

What are Role Based forms

Microsoft Dynamics CRM allows configuration of security roles in Entity forms. It is quite a common requirement for organizations where they want users of two different security roles to see different fields and sections.

For ex, a Sales person would want to see only the Sales details on the form and a CEO/ Director wants more details in the form.

Also, there is a possibility that there are 2 product lines which have different set of fields for the same entity.

Alternative approaches

From the above requirements, most users will think that the above can be achieved using form customizations or JavaScript on the form.

While this is true, this approach is not a feasible one when the 2 versions of form which we create are a lot different from one another.

JavaScript should be used when there are only few fields which we need to show/ hide on the form based on Security Roles.

How to enable/ implement Role based forms

Using/ enabling security roles in forms is very straight forward, but we have to be careful to set/ remove the roles carefully for each form.

  1. I have created two contact forms as below. As you can also see, there is a button on the top of Form section “Enable Security Roles” which we will use to configure form security

figure1

  1. By default, both forms are accessible to all the security roles. We will now change the security roles for each of the form
  2. For “Contact Form”, we will provide access to only CEO – Business Manager, CSR Manager and Marketing Manager. So Users with roles other than these will not be able to access this form.

figure2

  1. And similarly I will configure the security roles for the “Contact v2” form. We will assign roles Salesperson and Marketing professional for this form.

figure3

So we have now created 2 forms which users with different security roles will access. But there are few OTHER things which we need to address before we complete this entire process

Things to consider

When we implement Role based forms, the following questions pop up in our mind, for which I have also mentioned the solutions

Q1. What if the User has 2 security roles and thus have access to both the forms?

A: The User will see both the forms and there is an option for user to choose one of the forms in the Top left corner. Refer screenshot below:
figure4

The answer to Q1 will pop up another question:

Q2. If the user has access to two forms, which form will be visible by default to the User?

A: There are 2 parts:

  1. User access the Entity form for the very first time

When a User access the entity form for the very first time, the default form which User will see will depend upon the Form Ordering. This can be checked in Entity customizations like below:

Navigate to Form Order à Main form set
figure5

figure6

  1. When User changes the Form from the Dropdown

Whenever user changes the Form from the Dropdown, CRM stores the user preference. So when the user logs in next time or navigate to the same entity form next time, CRM shows the form that the user has used previously and will ignore Form ordering for the particular user.

Q3: What if a User has access to the entity but has no Access to any of the forms for his Security Role?

A: CRM is very smart and handles this by using “Fallback” mechanism. When we configure the Security Role for a form, there is a checkbox at the bottom à “Enable Fallback”

As you can read from the Description in the screenshot, this form will be shown to the Users with roles that don’t have any forms assigned.

CRM makes it mandatory to select at least 1 form for fallback.
figure7

Q4: What if I don’t want to make any of my forms as Fallback forms?

A: This is a valid scenario as we don’t want the users who are not explicitly assigned any role on the form to see the form.

As a workaround, we can create one form as a “Default Fallback” form which will not have any form fields (or 1-2 fields) and configure this form to be a fallback form.

Additionally, we can add a web resource (HTML) in this form which says something like this:

“If you are seeing this form and do not have access to any other form for Contacts, Please contact Administrator.”

Also, we should keep the Fallback form last in the Form Order.

This is how the fallback form would look like:
figure8

I hope this article was helpful. Please send comments if you need any clarifications.

Happy CRMing!!!


Viewing all articles
Browse latest Browse all 64797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>