Wanted to check "type" field from sys_user_group table using if activity(script) in workflow

Community Alums
Not applicable

Wanted to check group type using if activity in workflow

this is a workflow for a requested item. The If conditions depend on the field value which refer to group table, i want to check only two group types either it is Support or Finance 

Any suggestions on how to correct code below..

 

answer = ifScript();

function ifScript() {

var usrObj = new GlideRecord('sys_user_group');
usrObj.get(current.variables.cat_item_assignment_group);
if (usrObj.type == 'Support') {
return 'yes';
} else {
return 'no';
}
}

 

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

replace

 if (usrObj.type == 'Support') {

With

if (usrObj.type.getDisplayValue() == 'Support' || usrObj.type.getDisplayValue() == 'Finance') {

-Anurag

-Anurag

View solution in original post

5 REPLIES 5

Community Alums
Not applicable

thanks for quick response i really appreciate 

now its working with below code

 

answer = ifScript();

function ifScript() {

var usrObj = new GlideRecord('sys_user_group');
usrObj.get(current.variables.cat_item_assignment_group);
if (usrObj.type.getDisplayValue() == 'Support' || usrObj.type.getDisplayValue() == 'finance') {
return 'yes';
} else {
return 'no';
}
}