gs.getUser().isMemberOf(current.assignment_group) not working

pgrover
Giga Expert

hi,

When I write :

gs.getUser().isMemberOf(current.assignment_group) in my ACL , elow Error is encountered in logs.

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;

Can anyone please help me with the solution for this .

Mine is the SCOPED APPLICATION.

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

8 REPLIES 8

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.


 gs.getUser().isMemberOf(current.assignment_group.getDisplayValue())


This is working for me in a Scoped App, as a condition on a UI Action

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

Hi Prerna,



As I understand there is a lot of issuses with the gs.getUser()... etc. in scoped apps. gs.getUserID() should work, so sadly I think you need to just do a normal GlideRecord query with that and fetch the info through it.



U can always do something like


var gr = new GlideRecord('sys_user_grmember');


gr.addQuery('group',current.assignment_group);


gr.addQuery('user', gs.getUserID());


gr.query();



if(gr.hasNext() {


answer = true;


}


Yes , thanks for the reply .


I implemented this solution only from the above link posted by me .