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.

isMemberOf() function with dynamic group name.

pgrover
Giga Expert

I have 12 Assignment group .

My requirement is : Assigned should should be only editable if it's the member of group .

I have written the ACL on assigned to . It's working fine if I hardoce the Assignemtn group value in isMemeber of function .

But ebery time my Assignemtn group changes .

I have writtent he Below acl:

var x= current.assignment_group.name;

gs.info("Group nameeeeee="+x);

if(gs.getUser().isMemberOf(x))

{

 

  answer=true;

}

else

  {

  answer=false;

  }

But this is not working : It;s showing error in logs

1 ACCEPTED SOLUTION

pgrover
Giga Expert

Hello everyone ,



I got my answer .



Actually gs.getUser().isMemberOf doesnot work in SCOPED APPLICATION.


Please refer the lonk:


Configure the ServiceNow-initiated Qualys IP scan



I implemeted their script and it worked.


View solution in original post

9 REPLIES 9

prabhash_snow
Mega Expert

Hi Prerna,



Can you try this :



answer = false;                                                                                      


var x= current.assignment_group.name;


gs.info("Group nameeeeee="+x);


if(gs.getUser().isMemberOf(x))


{


  answer=true;


}


Not working.


Inactive_Us1289
Mega Contributor

Hi,



Ca you try gs.getUser()isMemberOf(current.assignment_group)



Thanks,


Tamoghna


Not working.