- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-18-2019 11:01 AM
Hey,
So I am automating a catalog item (full flow from opening up the item -> filling it out -> to checking out -> and all approvals (this can range from 2-4). I currently have everything hard coded meaning I am impersonating the Users manager. I don't like this approach and want to make it more dynamic and flexible so if I change the user who I am requesting for it will automatically pick up his manager.
I have tried:
// Get the current user's ID
var currentUser = gs.getUser();
gs.info(currentUser.getID());
// Get the manager of the current User and return that to the impersonate function
var currentUserManager = gs.currentUser.getManagerID();
return currentUserManager;
however on the next step when I try to impersonate the record that comes it says sys_id is NULL.
I also tried:
//answer = [];
//answer.push(current.variables.requested_for.manager);
however this did not work at all either. Can anyone provide insight? Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-22-2019 08:26 AM
I have solved this using : Record query : (Requested_for) user. Impersonating.recordquery.managerID. this does the job

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-18-2019 12:37 PM
There's a problem here:
var currentUserManager = gs.currentUser.getManagerID();
You don't need the "gs." part. It's this:
var currentUserManager = currentUser.getManagerID();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-18-2019 12:46 PM
Tried that as well still failing:
Unable to find the user to impersonate as the user sys id is null |

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-22-2019 12:14 AM
Hi,
Try to add toString() method to return managers sys_id as below.
answer.push(current.variables.requested_for.manager.toString());
Thanks,
Trupti S.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-22-2019 08:26 AM
I have solved this using : Record query : (Requested_for) user. Impersonating.recordquery.managerID. this does the job