web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)
Suggested answer

Forms fields hide/show based on User’s Security Role

(0) ShareShare
ReportReport
Posted on by 25
I am trying to map Salesforce “record type” feature (which let you offer different picklist values and forms layouts to users based on security roles) in Dynamics CRM. As per my understanding, in Dynamics, it can be achieved in 2 ways. 1) Use JavaScript to fetch User’s security role and based on that show/hide specific fields on form. 2) Create seperate forms and Enable Security Roles on forms which will provide only applicable forms to users. Note: One user can have multiple roles hence multiple forms are applicable. Please suggest which approach is better in terms of design, user experience and maintenance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Forms fields hide/show based on User’s Security Role

    Hello ,

    You are correct. Following are the way you can hide fields ,form , form sections tab in dynamics 365.

    - You can show /hide fields in Dynamics CRM using JavaScript , Business rules , Field level security.
    - To hide particular form in an entity you need to implement role based forms or using security roles.
    - To hide any form section and tab inside the form you can write javascript code.

    Now lets come to your scenario.

    1) Use JavaScript to fetch User’s security role and based on that show/hide specific fields on form.

    This is not a good idea , if you have few fields to hide then you can implement field level security profile in Dynamics 365. Assign those security profile to user and team to restrict the user. You can check below article -
    www.encorebusiness.com/.../microsoft-dynamics-crm-field-level-security

    If there is a condition or you need to hide fields depends on another field value then you can implement business rule to hide fields in same forms. You can check below article for business rules -

    docs.microsoft.com/.../create-business-rules-recommendations-apply-logic-form

    2) Create separate forms and Enable Security Roles on forms which will provide only applicable forms to users.

    Exactly same features you can achieve by using role based forms. You can have multiple forms for your entity . You can show hide those entity by applying particular security role. You can have multiple security roles for same different different form and assign multiple security roles to same user to show multiple form.
    Here is reference -

    community.dynamics.com/.../role-based-forms


    I always suggest try to use as much as OOB functionality which you can implement without any code , like business rules , field security profile instead of writing JavaScript code.


    Hope this will help you to understand.

    Good Luck.

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at
    RE: Forms fields hide/show based on User’s Security Role

    Hi Athar,

    As you mention above and Goutam recommended below there are two options.

    Using JavaScript or Form based Security Roles is your option.

    I would say you have to consider a solution based on the amount of separate customizations that you have on the form.

    If you have very few differences between one security role and the next, you can use JavaScript.

    If your forms are quite different, then definitely use the approach of multiple forms.

    I am not sure which version of Dynamics CRM Online you are on, but if you are on version 9, you should consider the following.

    If the reason for displaying different forms is different organizational roles, you might also consider using apps.

    This will allow you creating different applications in where different organizational units will only see their portion of the application. For examples you would have an application for Sales and an application for Service (as already available out of the box). Of course this will be using the new Unified Interface and not the standard interface.

    Hope this helps.

  • AtharAbbas Profile Picture
    25 on at
    RE: Forms fields hide/show based on User’s Security Role

    I am using Dynamics 365 v9.0 and have to hide/show few fields (ranging from 2 to 10) on Case form based on user's security role.

    Creating different forms will be confusing for users as they will have different roles (means access to different forms). Hence, creating Case # 1 with Form#1 then creating Case #2 with Form#2. Now opening Case#1 it will open in Form#2 and they will have to remember and manually changed it to Form#1 to see those specific fields. Not a great user experience!

    Finally, I am creating just one Case Form. Providing one options set which gets filtered based on user's security role (using JavaScript). User selects a value from this option set and based on selected value, I am using Business Rules to show/hide fields on form.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans