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

getting error :



java.lang.RuntimeException: failed to coerce com.glide.script.fencing.ScopedGlideElement to desired type java.lang.String


Caused by error in Access Control: 'x_mkgaa_non_confor_non_conformance_tasks.assigned_to' at line 2



1:


==> 2: if(gs.getUser().isMemberOf(current.assignment_group))


3: {


4: gs.info("groupppppp name okkk");


5: answer=true;


Vishal Khandve
Kilo Sage

can you try this:



if(gs.getUser().isMemberOf('Assignment group'))


{


answer = true;


}


else


{


answer = false;


}


this would be hard-code type .


But I want if the user is member of particular assignemnt group.



"gs.getUser()isMemberOf(current.assignment_group)" This is also not working.




Hey,



Can you try this gs.getUser()isMemberOf(current.assignment_group.sys_id+'')


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.