- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 02:03 AM
Hi All,
I have a situation in which if an approver is not approving/rejecting the request an escalation email goes to his/her manager in 2 days. That works fine through scheduled jobs.
Now I also want to add the manager to approver to approval list at the same time. and when any one of the approver approves the request should get approved. Please help me with the approach...is it approval rules I should use?...is it something else?.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 05:05 AM
Hi
The function you are trying to use does not exist on a glide record. It exist in the WorkflowApprovalUtils script include.
This script include is used by the workflow Approval activity.
You cannot add additional approvers outside the workflow, as the workflow activity will not be aware of them, so when they approve or reject, nothing will happen in the workflow.
You can implemented the changes I have suggested in the workflow and it will work for future requests, but not for the current onces.
You could consider adding the manager as a delegate to the approver to allow them to approve the current items.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 02:52 AM
Hi
At the point in the workflow where you generate the first approval add a timer running in parallel. Set it to two days. After the timer you add an If condition where a script checks if the approval for the request has been processed.
If the answer is no you generate an extra approval for the manager. Both of the approval leads to the same point in the remaining workflow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 04:47 AM
Hi Lars,
Thanks for your quick reply but the issue is I have to do it for all existing cat items.. Changing the workflow for all isn't feasible..so I am looking for an script in the server side where I can add user/manager to approval list. If you have any method which does this will be helpful...currently I was trying to do something like this in the scheduled job
var day = 04;
var cnt = 0;
var pn = parseInt(day);
var now = new GlideDateTime();
//Run only on weekdays
if(now.getDayOfWeek() < 6){
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('source_table', 'sc_req_item');
gr.addQuery('state', 'requested');
gr.addQuery('sys_updated_on', '<=', gs.daysAgoStart(pn));
gr.query();
while(gr.next()) {
var manager_name = gr.approver.manager.sys_id;
gs.log("manager names"+manager_name);
gr.addIdsToApprovalList(manager_name);
gs.log("added approver as"+manager_name+gr.approver.manager.name);
gs.eventQueue('app.email.leader', gr , gr.approver.manager.email, gr.approver.manager.name);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 04:48 AM
I am trying with the method gr.addIdsToApprovalList(manager_name);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2017 05:05 AM
Hi
The function you are trying to use does not exist on a glide record. It exist in the WorkflowApprovalUtils script include.
This script include is used by the workflow Approval activity.
You cannot add additional approvers outside the workflow, as the workflow activity will not be aware of them, so when they approve or reject, nothing will happen in the workflow.
You can implemented the changes I have suggested in the workflow and it will work for future requests, but not for the current onces.
You could consider adding the manager as a delegate to the approver to allow them to approve the current items.