How to add Role in condition in Onload client script??

Santosh Kallim1
Giga Contributor

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');
}
}

5 REPLIES 5

Pranay Tiwari
Kilo Guru

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');
	}
}