In catalog item Trigger approval for ServiceDesk group if requested for has an ITIL Role.

Mannam Praveen
Tera Expert

Hello 

 

I had requirement to trigger approval in the cataog item. once requested submitted it need to check whether Requester for user has an ITIL role in his profile or not. if it is there it will trigger approval for ServiceDesk group, how acheive this using workflow.

1 ACCEPTED SOLUTION

Jan Cernocky
Tera Guru

Hi, I would go with IF workflow activity and click on Advanced in detail and check the role with a script, something like this

 

answer = ifScript();

function ifScript() {
	var userRole = new GlideRecord('sys_user_has_role');
	userRole.addQuery('role', 'itil');
	userRole.addQuery('user', current.getValue('requested_for'));
	userRole.setLimit(1);
	userRole.query();
	if (userRole.hasNext()) {
		return 'yes';
	}
	else {
		return 'no';
	}
}

 

Then I would just add two approval activities, one with Service Desk and the other with other group or whatever you want to do.

 

JanCernocky_0-1699021792840.png

 

View solution in original post

2 REPLIES 2

Jan Cernocky
Tera Guru

Hi, I would go with IF workflow activity and click on Advanced in detail and check the role with a script, something like this

 

answer = ifScript();

function ifScript() {
	var userRole = new GlideRecord('sys_user_has_role');
	userRole.addQuery('role', 'itil');
	userRole.addQuery('user', current.getValue('requested_for'));
	userRole.setLimit(1);
	userRole.query();
	if (userRole.hasNext()) {
		return 'yes';
	}
	else {
		return 'no';
	}
}

 

Then I would just add two approval activities, one with Service Desk and the other with other group or whatever you want to do.

 

JanCernocky_0-1699021792840.png

 

DanielCordick
Mega Patron
Mega Patron

Jan's script should work for you, however you should build it into a flow, the workflow editor is legacy and as of Vancouver you won't be able to create new workflows