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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Allow access to a single field on an opportunity

(0) ShareShare
ReportReport
Posted on by 5

Hi,

Is it possible to enable write privileges on a single field without enabling field security for all other fields? I want to block write privileges on all other fields for a specific security role/team, preferably without enabling field security on all other fields.

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Field Level Security level is tough. I would say the easier way to be writing pre-update plugin and if privileges are not there throw an exception.

  • Verified answer
    Leah Ju Profile Picture
    Microsoft Employee on at

    Hi rswaans,

    By default, the 'field security' option is 'disabled' for all fields of the opportunity entity.

    If you want to use field level control, you have to enable it for all fields excluding a specific field.

    Maybe you can try to use js to disable/enable one field based on the security role:

    (1)Js Code:

    If current use has the specific security role, lock all controls of the form, then unlock the specific field again.

    function disableField (execContext) {
    
    var formContext = execContext.getFormContext();
    var userSettings = Xrm.Utility.getGlobalContext().userSettings;
    
    //Get Security Roles of the current User
    var securityRoles = userSettings.securityRoles;
    
    //Below is the GUID of the Security Role "Account Manager"
    var securityRoleId = "A39E17FE-12AB-E411-80D9-00155DB98105";
    
    ////No argument returns all controls on the form
    var formControls = formContext.getControl(); 
    
    
    for (i = 0; i < securityRoles.length; i  ) {
    
    //If current User contains the Required Security Role
    if (securityRoles[i].toUpperCase() == securityRoleId.toUpperCase()) 
    {
    
    //Lock all controls
    formControls.forEach(control => {
                    control.setDisabled(true);
                });
    
    //unlock the specific field
    formContext.getControl("description").setDisabled(false);
    }
    }
    }

    (2)Add js as web resource, then add to opportunity form.

    pastedimage1671183397599v1.png

    pastedimage1671183493032v2.png

    Save and publish all customizations.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 115

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 74 Super User 2026 Season 1

#3
Martin Dráb Profile Picture

Martin Dráb 56 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans