Skip to main content

Notifications

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 how to find out whether the user has a specific role or not by coding. I am required 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