Determine if a user from a variable has ITIL role

Joe Taylor
Giga Guru

I have an offboarding workflow triggered by a catalog item.

There is a variable in the form called "employee_name".

 

I would to setup a task in my workflow if this user has an "itil" role.

I can't seem to figure out how to get this information from the variables.

 

I can populate a variable called Employee role from the sys_user table attribute "roles" on the form, but it comes up blank.

 

I'm would like a recommendation on the best way to handle this requirement.

1 ACCEPTED SOLUTION

Syntax looks fine. Just need to add current.variables.

 

answer = ifScript();
 
function ifScript() {
 
if ((gs.getUser().getUserByID(current.variables.employee_name).hasRole('itil')){
return 'yes';
}
return 'no';
}

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

7 REPLIES 7

I can't seem to get the syntax right.

Is this script correct?

 

answer = ifScript();
 
function ifScript() {
 
if ((gs.getUser().getUserByID(employee_name).hasRole('itil')){
return 'yes';
}
return 'no';
}

Syntax looks fine. Just need to add current.variables.

 

answer = ifScript();
 
function ifScript() {
 
if ((gs.getUser().getUserByID(current.variables.employee_name).hasRole('itil')){
return 'yes';
}
return 'no';
}

Please mark this response as correct or helpful if it assisted you with your question.

This worked great!  Thanks so much 😀