how to use script include in filter condition under change approval policy.

Vignesha Priya
Tera Contributor

Please suggest how to use script include in filter condition under change approval policy. I need to get values dynamically populated.

This is my script. Where can I add arguments (intended groups) to this script and how can the mail ID be returned

var checking_user_is_part_of_specific_Group = Class.create();
checking_user_is_part_of_specific_Group.prototype = (AbstractAjaxProcessor, {
initialize: function() {
answer = ifScript();

function ifScript() {
var ABC= gs.getProperty('ABC.grp');
var BCD= gs.getProperty('BCD.grp');
var DEF= gs.getProperty('DEF.grp');
var REH= gs.getProperty('REH.grp');

var answer;

if (gs.getUser().isMemberOf(ABC) || gs.getUser().isMemberOf(BCD)|| gs.getUser().isMemberOf(DEF)|| gs.getUser().isMemberOf(REH)){

return "yes";
} else {

return "no";
}
}

type: 'checking_user_is_part_of_specific_Group';
}
});

I need to use this script here. Please help me to understand how it can be done.

VigneshaPriya_0-1683808795083.png

 

1 ACCEPTED SOLUTION

Yousaf
Giga Sage

Hi Vignesha,
Please try 

 javascript: new scriptIncludeName.functionName();

OR

javascript: scriptIncludeName.functionName();

 

Mark Correct and helpful if it helps.


***Mark Correct or Helpful if it helps.***

View solution in original post

6 REPLIES 6

Yousaf
Giga Sage

Hi Vignesha,
Please try 

 javascript: new scriptIncludeName.functionName();

OR

javascript: scriptIncludeName.functionName();

 

Mark Correct and helpful if it helps.


***Mark Correct or Helpful if it helps.***

Thanks @Yousaf 

That worked !!! I could use a script include as part of Filter condition.

@Yousaf 

javascript:new scriptIncludeName.functionName([ABC,BCD,GFH);
May I know if this will work
So comma disappears after I save
I am unable to iterate array elements

I haven't tried this before but I believe you cannot call arrays like this.


***Mark Correct or Helpful if it helps.***