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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Workaround for Field-L...
Power Apps
Unanswered

Workaround for Field-Level Security on Account.Name field

(1) ShareShare
ReportReport
Posted on by 6
Hello,
 
Can anyone suggest a workaround to applying field-level security on the Name field on the Account entity?  The one thing that comes to mind is a custom text field and a real-time CRM process to keep the default "name" field value updated.
 
Thank you,
 
Bob
2024-07-29_12h21_46.png
I have the same question (0)
  • Giraldoj Profile Picture
    895 Moderator on at
    Hi there Bob,
     
    Well depending on what you want to achieve you can use different workaorunds, in addition to what you mentioned you can also use a business rule to prevent the users to fill information.
     
    if you want some specific users/groups/roles to fill the information probably the best option is to use a webresouce with JavaScript in the onload event of your form, here is a detailed explanation on how to use javascript in dynamics.
     
     
    if you can provide more detailed on your requirement i might be able to provide a detailed sample fo the code you should use. but in general it should be something like this:
    function setFieldSecurity(executionContext) {
        var formContext = executionContext.getFormContext();
    
        // Get current user roles
        var userRoles = Xrm.Utility.getGlobalContext().userSettings.roles;
    
        // Define the role that has permission to edit the field
        var allowedRoleName = "System Administrator";
    
        var hasAccess = false;
    
        // Check if the current user has the allowed role
        userRoles.forEach(function (role) {
            if (role.name === allowedRoleName) {
                hasAccess = true;
            }
        });
    
        // Get the field and set it read-only if the user does not have access
        var fieldName = "name"; // Change to your field name
        if (!hasAccess) {
            formContext.getControl(fieldName).setDisabled(true);
        }
    }
    
    If this helps, please mark it as the solution by clicking "Accept as solution." A "Thumbs Up" would be greatly appreciated if you found the content helpful. Thanks!
    Best,
    LinkedIn:  https://www.linkedin.com/in/jhonatan-giraldo-2b20561b9/
     

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 Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 762

#2
11manish Profile Picture

11manish 640

#3
Valantis Profile Picture

Valantis 548

Last 30 days Overall leaderboard