Workflow - Script to update user's manager

hongsok
Tera Contributor

Dear all,

I created a Catalog Item for user to change their manager (from current to new manager). The following script that I used to update the new_manger field after the approval of the new manager and it is not working.

Could you all help me on this? 

 

var user_ref = current.variable.caller_id;
var user_man = current.variables.new_manager;

var userU = new GlideRecord ('sys_user');
userU.addQuery('sys_id',caller_id);
userU.query();
if (userU.next()){
userU.manager = user_man;
userU.update();
current.variables.manager = current.variables.new_manager;
gs.addInfoMessage("Manager has been updated to " + user_man);
}

Regards,

Hong

1 ACCEPTED SOLUTION

Hi Hong,

Glad I could help. Since my answer solved your question, please mark my answer as correct so we can close this thread.

Brent

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

View solution in original post

6 REPLIES 6

Thanks.

Hi Hong,

Glad I could help. Since my answer solved your question, please mark my answer as correct so we can close this thread.

Brent

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.