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

Kannan Nadar
Tera Guru

Hey,



I just replied to your other thread. Use



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



OR



gs.getUser().isMemberOf(current.assignment_group.sys_id+'')


Please note that you never want to use code like:

current.assignment_group.sys_id

Instead do this:

current.getValue( 'assignment_group' )

Dot walking to a 'sys_id' actually LOOKS UP the 'assignment_group' by 'sys_id' only for the record to be used to return the 'sys_id'.  It is a completely wasted lookup.

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

 

This one works!

Gurpreet07
Mega Sage

Try below instead


if(gs.getUser().isMemberOf(current.assignment_group.toString()))


OR


if(gs.getUser().isMemberOf(current.assignment_group.name))