ATF: Server Side Script to return User's Manager

DefinitelyNotTh
Giga Contributor

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!

 

1 ACCEPTED SOLUTION

DefinitelyNotTh
Giga Contributor

I have solved this using : Record query : (Requested_for) user. Impersonating.recordquery.managerID. this does the job 

View solution in original post

5 REPLIES 5

Could you please tell me... where did you write this step. Ineed this.