Skip approval if opened by an assignment group

Jen11
Tera Expert

I am working on a catalog item, and the requirement is to skip approval if it is opened by a certain assignment group. Could someone help me with the script for the If activity on the workflow. 

 

Thank you. 

1 REPLY 1

James Chun
Kilo Patron

Hi @Jen11,

 

Try the following, note that you need to replace {sys_id of group} with the sys_id of your group.

answer = ifScript();

function ifScript() {
    var memberGr = new GlideRecord('sys_user_grmember'); 
    memberGr.addQuery('user', current.getValue('opened_by')); 
    memberGr.addQuery('group', '{sys_id of group}');
    memberGr.query();
    if (memberGr.getRowCount > 0) {
        return 'yes'; //user is a member of at least one or more groups
    }
    return 'no';
}