How to find out whether the user has a specific role or not by code? #D365 #dynamics
Views (234)
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.
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.

Like
Report
*This post is locked for comments