Timer Activity in workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2024 12:36 AM
Hi, I have created a workflow where there are 2 level of approvals and for each approval there is 15 days timer. if the first approver doesn't approve of reject within 15 days then the approval should be auto rejected ritm should be closed complete. If the first approver approves it then it should go for second approval based on entity field it will be assigned to particular group and that group will also have timer of 15 days, if not taken action then approval will be auto rejected and if approved then catalog task will be created accordingly and ritm will be closed complete if all catalog task are completed manually.
here is the workflow which I created but it not working as it goes on previous timer and second timer gets cancelled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2024 10:39 PM
@Pratiksha Lang1 Please find my implementation steps and outline to achieve the use case,
1. Created a workflow with 2 approval activities as below.
Note: Please add your validations in between.
2. Create a scheduled job to validate the approval records which where created 15 days ago and reject them.
Note: For validation, you can click on "Execute Now" but in reality schedule it for Daily with timelines
Scheduled Job Condition :
var gr = new GlideRecord('sysapproval_approver');
//gr.addEncodedQuery('state=requested^sysapproval.numberLIKEritm^sys_created_on<javascript:gs.beginningOfLast7Days()^sysapproval.ref_sc_req_item.cat_item=<sys id of your catalog item>');
gr.addEncodedQuery('state=requested^sysapproval.numberLIKERITM^sys_created_onRELATIVELT@dayofweek@ago@15^sysapproval.ref_sc_req_item.cat_item.sys_id=039c516237b1300054b6a3549dbe5dfc');
gr.query();
gr.hasNext();
Scheduled Job Run this script:
var gr = new GlideRecord('sysapproval_approver');
//gr.addEncodedQuery('state=requested^sysapproval.numberLIKEritm^sys_created_on<javascript:gs.beginningOfLast7Days()^sysapproval.ref_sc_req_item.cat_item=<sys id of your catalog item>');
gr.addEncodedQuery('state=requested^sysapproval.numberLIKERITM^sys_created_onRELATIVELT@dayofweek@ago@15^sysapproval.ref_sc_req_item.cat_item.sys_id=039c516237b1300054b6a3549dbe5dfc');
gr.query();
while(gr.next()){
gr.state = 'rejected';
gr.update();
}
Results:
1. First Level Rejection
On execution of scheduled job,
2. Second Level Rejection
On execution of scheduled job,
Approval will move forward if its done within 15 days,
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.