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.

Module not working while impersonating user.

Hrishabh Kumar
Giga Guru

I have created a module under name "Servers assigned to me and my assignees".

What is does: 

it brings the servers which are assigned to the group, in which :

1) current user is a member of.

2) one of current user's assignee is a member of.

3) one of current user's super assignee is a member of.

 

What I have done:

1)I have used a script include that takes a users sys_id in beginning.

2)it finds all of the assignees and super assignees of the user.

3)and returns an array of sys_id of groups.

I am calling this script include in the filter condition of  as "javascript:functionName();", and it is working.

 

Problem:

If I directly pass the sys_id of a User "A", and open the module I am able to see all the servers.

but, If the pass the sys_id dynamically as "gs.getUserID()"  and impersonate user "A" and open the module I am not able to see any servers.

Note: I did the same with a user "B" and it was working properly.

 

 

1 REPLY 1

Karan Chhabra6
Mega Sage

Hi @Hrishabh Kumar ,

 

Could you please the code snipped of the script include that you've created?