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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

How to find out whether the user has a specific role or not by code? #D365 #dynamics

Krishna Bhardwaj Profile Picture Krishna Bhardwaj 97
Today I'll describe that how to find out whether the user has a specific role or not by coding. My requirement is to enable or disable one field on the form based on a specific user role. 


    public void init()
    {
        next init();
        if (xUserInfo::checkUserRole('Manager'))
        {
            BypassFormulaLineSpecification.enabled(true);
        }
        else
        {
            BypassFormulaLineSpecification.enabled(false);
        }
    }


Here, I'm looking for 'Manager' role, and if the user has that role, then the BypassFormulaLineSpecification field will be enabled. 

Comments

*This post is locked for comments