Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

need help with Script include

Renu4
Tera Contributor

Hello All,

i have a script include in which i would like to add 3 groups in the condition but not sure how to do it .need some help.

The script is:

   if (!gs.getUser().hasRole('ABS_EXT_FTS'))
        {result += '^name!=EXT_FTS' ;}
        return result + '^ORDERBYDESCu_order';
    },
I want to change the result line where the groups can be multiple like below.;
 
   if (!gs.getUser().hasRole('ABS_EXT_FTS'))
        {result += '^name!=EXT_FTS' ; || '^name!=EXT_FTS_NW' ; || '^name!=EXT_FTS_Storage' ; }
        return result + '^ORDERBYDESCu_order';
    },
 
How do i achieve it.
1 ACCEPTED SOLUTION

if (gs.getUser().hasRole('itil')) {
    result += '^nameINEXT_FTS,EXT_FTS_NW,EXT_FTS_Storage'; 
}
else if(gs.getUser().hasRole('ABS_EXT_FTS')){
result += '^name!=EXT_FTS^name!=EXT_FTS_NW^name!=EXT_FTS_Storage'; 
}


return result + '^ORDERBYDESCu_order';

View solution in original post

5 REPLIES 5

Sandeep Rajput
Tera Patron
Tera Patron

@Renu4 Update your script as follows.

   if (!gs.getUser().hasRole('ABS_EXT_FTS'))
        result += 'name!=EXT_FTS^ORname!=EXT_FTS_NW^ORname!=EXT_FTS_Storage';
        return result + '^ORDERBYDESCu_order';
    },

Hope this helps.