Check if a user for a given userID has snc_internal role from scoped application

DILEEPKUMAS7622
ServiceNow Employee
ServiceNow Employee

In global application scope, we can check if a user has a role using the below API:
new GlideUser().getUserByID(userId).hasRole(roleName)

But for scoped applications, i'm not able to find a similar method. For a given userID and in my application scope, i want to check if it has snc_internal role or not?

5 REPLIES 5

@DILEEPKUMAS7622 

it's not supported, so the only option is to query sys_user_has_role table

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader