How to change the state of a CI request based off of manager

gunishi
Tera Guru

Hi all, 

 

I have the following requirements:

 

• Once request is submitted approval should go to Manager of the group ‘Food Warriors’.

• Approval Conditions-

    o If manager of the group is missing/inactive then request should get closed cancelled.

    o If manager of the group rejects the requests then it should be moved to rejected state.

 

How would I implement this?

 

For the first task I had initially added an approval - user task to my workflow and added the following script:

 

answer = [];

var gr = new GlideRecord('sys_user_group');

gr.addQuery('sys_id', 'c9666099973131104a02bcb3f153afb8');

gr.query();

while(gr.next()){

var mng = gr.manager;

}

answer.push('mng');

 

However, I then realised that I wouldn't be able to implement the last two bullet points. Workflow is the tool that I am struggling the most with on ServiceNow so any help would be greatly appreciated. 

 

Kind regards , 

G

0 REPLIES 0