Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : O67MTIn6Lvq2pqewe0QWHs
Finance | Project Operations, Human Resources, ...
Suggested answer

How to make the default view as read only for an entity so no user can edit the field in that view.

Like (3) ShareShare
ReportReport
Posted on 26 Mar 2025 11:22:20 by 6
Thanks in Advance, Can anyone help me on how to make the default public view of an entity as read only or restrict the user to edit any column in that view. If I select any record all the column are shown as locked except the highlighted columns. Is there a way to  lock the those columns in the view or to make the whole view as read only.
 
  • Suggested answer
    Holly Huffman Profile Picture
    4,023 on 27 Mar 2025 at 11:26:26
    How to make the default view as read only for an entity so no user can edit the field in that view.
    Hi there! Good morning, evening, or afternoon - depending on where you are :) Hope you are well today! 
     
    To make the default view of an entity read-only in Dynamics 365, you can achieve this by leveraging field-level security or custom JavaScript. Here's how you can approach this:
    1. Field-Level Security
    • Use field-level security to restrict editing of specific fields in the entity:
      • Navigate to Settings > Security > Field Security Profiles.
      • Create a new profile or edit an existing one.
      • Add the fields you want to lock and set their permissions to Read-only for the relevant users or teams.
    • This ensures that users can view the fields but cannot edit them, even in the default view.
     
    2. Custom JavaScript
    • Add JavaScript to the entity form to dynamically lock fields based on the view:
      • Navigate to Settings > Customizations > Customize the System.
      • Open the entity form and add a JavaScript web resource.
      • Use the following code snippet to lock fields:
        function lockFields(executionContext) {
            var formContext = executionContext.getFormContext();
            var fieldsToLock = ["field1", "field2"]; // Replace with actual field names

        fieldsToLock.forEach(function(field) {
                var attribute = formContext.getAttribute(field);
                if (attribute) {
                    attribute.controls.forEach(function(control) {
                        control.setDisabled(true);
                    });
                }
            });
        }
      • Register the script on the form's OnLoad event.
    3. Use a Custom View
    • Create a custom view that displays the required fields but restricts editing:
      • Navigate to Settings > Customizations > Views.
      • Create or edit the default view for the entity.
      • Configure the view to display only the fields you want users to see.
    • While this doesn't lock the fields, it limits what users can interact with.
     
    4. Role-Based Security
    • Use role-based security to restrict editing permissions for the entity:
      • Navigate to Settings > Security > Security Roles.
      • Edit the relevant role and set the entity's permissions to Read-only.
    5. Test the Configuration
    • After implementing the changes, test the default view to ensure that the fields are locked and users cannot edit them.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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... 293,325 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,223 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans
Loading started