Skip to main content

Notifications

Announcements

No record found.

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

  • 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.

  • Suggested answer
    Aric Levin Profile Picture
    30,188 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.

  • Suggested answer
    gdas Profile Picture
    50,089 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.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,762 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans