How to add Role in condition in Onload client script??
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2019 11:50 PM
Hello,
I have created the below code, I need to add role condition.
example: If user has role 'ABCD' then execute this.
Can anyone help
function onLoad() {
var state = g_form.getValue('state');
if(state == 6) {
g_form.removeOption('state', '3');
}
if(state == 4) {
g_form.removeOption('state', '-5');
}
}
Labels:
- Labels:
-
Scripting and Coding
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2019 12:16 AM
Hi,
Use below code as your requirement..,
var state = g_form.getValue('state');
if(g_user.hasRoleExactly("itil")){
if(state == 6) {
g_form.removeOption('state', '3');
}
if(state == 4) {
g_form.removeOption('state', '-5');
}
}