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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Can we hide fields based on security roles? What is best way?

(0) ShareShare
ReportReport
Posted on by

We want to hide certain fields from appearing based on security role.  Is this possible?  I know with Field Security you can make fields read only but they still appear.

What is the best way to hide fields completely for certain users?

I have the same question (0)
  • Suggested answer
    ACECORP Profile Picture
    1,589 on at

    Yes, there are several ways to do that actually.

    1. One way, the out of box way, is to use Field Security Profiles to change users ability to read/write data to the field as well as hide the contents of the field based on Security Role. See: https://docs.microsoft.com/en-us/power-platform/admin/field-level-security
    2. The second way is to use JavaScript to "check" if the user has a certain security role assigned to them, and if they do, you can make a lot of different UI changes using JavaScript. This is in the realm of custom development, but it opens up the UI to a lot of different capabilities based on if the user is a member of a specific security role or not. 

    An example of how to implement a JavaScript check for security roles, and action the UI based on the result is shown below. 

    function UIActionBasedOnSecurityRole() {
        var roles = [];
        roles[0] = "Insert_Desired_Security_Role_Name_Here";
        var IsUserMemberOfRDR = currentUserHasSecurityRole(roles);
    
        function currentUserHasSecurityRole(roles) {
            var fetchXml = ""   ""   ""   ""   ""   ""   ""   ""   "";
    
            for (var i = 0; i < roles.length; i  ) {
                fetchXml  = "";
            }
    
            fetchXml  = "            "   ""   ""   ""   "";
            var modifiedFetchXml = fetchXml.replace("&", "&");
            var users = ExecuteFetch(modifiedFetchXml, "systemusers");
            if (users > 0) return true;
            else return false;
        }

  • CRM Learner 88 Profile Picture
    on at

    Thank you.  With field security the Field Label still would appear though right?

  • ACECORP Profile Picture
    1,589 on at

    Yes, the field label will be present and visible. Depending on the specific Field Security setting you implement, the data inside the field will either be readable or hidden with *** characters.

  • CRM Learner 88 Profile Picture
    on at

    Thank you.  I know business rules can do JS through configuration but I don't think you can make an option to hide via security role through there so would have to be JS

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 180 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans