get current login user role in client script

Ha Le
Tera Expert

how get user role in client script, thanks 

6 REPLIES 6

harshav
Tera Guru

You have two functions that will tell user has role or not.

g_user.hasRole('itil');

g_user.hasRoleExactly('itil');

can it using in widget, thanks you 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you want to know all roles of logged in user at client side?

what's your business requirement?

you can check if logged in user has particular role or not in client script

g_user.hasRoleExactly('roleName');

Regards
Ankur

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

i want to check if user is admin, then post comment

find_real_file.png