whenever line Manager.manager also not approved with in five days then request will be cancelled

Nareshpatel
Tera Expert

when a line manager not approved with in 3 days then the notification goes to linemanager.manager . If linemanager.manager also not approved with in five days( this period line manager should be also able to approve ) , then the request will be cancelled.

Please help anyone to script provide

2 ACCEPTED SOLUTIONS

AshishKM
Kilo Patron
Kilo Patron

Hi @Nareshpatel ,

You can use Timer logic parallel to manager approval and check for 3 days, after the Timer , add the If condition and check if approval record approved by manager or not. If not then add next level manager approval and apply the same timer logic.

 

Let us know if you are applying this logic in some workflow/or/flow.

 

-Thanks,

AshishKM

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

View solution in original post

Hi Ashish,

Client want scheduled script  only (because of many cat_items there , )   instead of flows designer or workflows, Could you please provide valid script ,thanks.

View solution in original post

8 REPLIES 8

AshishKM
Kilo Patron
Kilo Patron

Hi @Nareshpatel ,

You can use Timer logic parallel to manager approval and check for 3 days, after the Timer , add the If condition and check if approval record approved by manager or not. If not then add next level manager approval and apply the same timer logic.

 

Let us know if you are applying this logic in some workflow/or/flow.

 

-Thanks,

AshishKM

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hi Ashish ,

Client want scheduled script  only (because of many cat_items there , )   instead of flows designer or workflows, Could you please provide valid script ,thanks.

var ritmGR = new GlideRecord('sc_req_item'); ritmGR.addEncodedQuery('active=true^cat_item=fd29303dab4690d0e633adc3ca96198d^approval=requested^sys_created_onRELATIVELT@dayofweek@ago@1'); ritmGR.query(); while (ritmGR.next()) { var user = <a class="" title="http://ritmgr.u_requested_for.name/" href="http://ritmGR.u_requested_for.name" target="_blank" rel="noreferrer noopener">ritmGR.u_requested_for.name</a>.toString(); //gs.log(user); var number = ritmGR.number; // gs.log(number); // var lineManager = ritmGR.variables.manager_id; // gs.log(<a class="" title="http://ritmgr.variables.manager_id.name/" href="http://ritmGR.variables.manager_id.name" target="_blank" rel="noreferrer noopener">ritmGR.variables.manager_id.name</a>); var lineManager = ritmGR.variables.user_id.manager ; } var managerGR = new GlideRecord('sys_user'); var managerManager = ''; if (managerGR.get(lineManager)) { managerManager = managerGR.manager; // gs.log(<a class="" title="http://managergr.manager.name/" href="http://managerGR.manager.name" target="_blank" rel="noreferrer noopener">managerGR.manager.name</a>); } if (!managerGR.manager.vip) { gs.eventQueue('kf_inactive_line_manager', ritmGR, user, managerManager); }

Hi, 

I am not sure, why you use some "http" href url in code.

You need to write code on Approval table not the RITM table.

Fetch all records from approval table which belog to any RITM ( use Task Type check ) and created before last 3 days ..... 

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution