Requests: Line Manager Approval

Anita12
Kilo Contributor

Hi

I'm new to scripting in ServiceNow but not new to ServiceNow as a product.

I want to introduce a Line Manager approval via email for all new Hardware and Software requests.

The Line Manager name entry is on an Order Guide we have as a variable.  The variable is in a set and is global and cascaded.  

I understand that I should be able to use the code in my workflow:

answer = [];

answer.push(current.variables.manager.sys_id);

answer.push(current.variables.div_dir.sys_id);

 

However this doesn't seem to work for me.....  Can someone offer me some advice where I might be going wrong.  We are on version Kingston.

Thanks in advance

Anita

1 ACCEPTED SOLUTION

Carl Fransen1
Tera Guru

We are using workflow to manage all our approvals - including line manager (which we get from the user record) and other ones as needed - these values are all placed into variables.

Inside the workflow I use the 'Approval User' activity - and inside the activity I have checked 'advanced' and enter the below in the 'Additional Approvers Script':

answer = [];
answer.push(current.variables.u_line_manager);

 

Note: 'u_line_manager' is my variable name.

This works for all my approvals.

 

We are on Jakarta, so I haven't moved any of these to the 'flow designer' as yet.

 

Hope this helps.

Carl.

 

 

View solution in original post

12 REPLIES 12

Error resolved.

Here is my code, however now it seems to skip the approval......

 

var user_linemanager;


var gr=new GlideRecord('sc_req_item');


gr. addQuery('request', current);


gr.query();


if(gr.next()){


user_linemanager=gr.variables.linemanager_approval_sw;


}

Carl Fransen1
Tera Guru

We are using workflow to manage all our approvals - including line manager (which we get from the user record) and other ones as needed - these values are all placed into variables.

Inside the workflow I use the 'Approval User' activity - and inside the activity I have checked 'advanced' and enter the below in the 'Additional Approvers Script':

answer = [];
answer.push(current.variables.u_line_manager);

 

Note: 'u_line_manager' is my variable name.

This works for all my approvals.

 

We are on Jakarta, so I haven't moved any of these to the 'flow designer' as yet.

 

Hope this helps.

Carl.

 

 

Thanks Carl.  This pretty much resolved my query.  I had to write some other script around this but I'm now working and Live 🙂