- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 06:21 AM
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.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 07:35 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 07:35 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 09:59 AM - edited 11-03-2023 09:59 AM
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