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 :

Enable/ Disable/allowEdit any field for users with an admin role in Dynamics 365. #ax #d365

Krishna Bhardwaj Profile Picture Krishna Bhardwaj 97

 Hi There,

                Today, I'll explain how to disable a field if the user does not have an admin role. I added a new field on VendTable and then added that field to the VendTable form. Now, my requirement is to make this field editable only for users with an admin role.

I created a new class to extend the VendTable form. In the init() method, I added the logic for a new field. We can also enable or disable any field in this way.

/// <summary>

/// Extension class of VendTable table.

/// </summary>

[ExtensionOf(formStr(VendTable))]

final class VendTable_Form_Extension

{

    /// <summary>

    /// Coc of init()

    /// </summary>

    void init()

    {

        next init();

        vendTable_ds.object(fieldNum(VendTable,

        NewField)).allowEdit(Global::isSystemAdministrator());

    }

 

}

Comments

*This post is locked for comments