- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2016 11:51 AM
Hi all,
We currently have a script that allows for approval escalations which flows as follows:
- Item is requested and manager approval is required.
- If 2 days goes by and the manager has not approved, escalate to the manager's manager.
- 2 days later, repeat this process and escalate to the manager's manager's manager.
The script checks to see if the next manager in the chain is a VIP:
- If the next manager is VIP, stop execution of the approval escalation workflow.
- If the next manager is NOT a VIP, continue to escalate up the chain every 2 days.
Now functionally the script is taking the old manager out of the approval record, replacing it with the manager that the approval was escalated to and calling .update(). Which means that if the original approving manager suddenly grants approval 2.5 days in, after it has escalated, the approval is discarded because that particular manager is no longer listed as an approver.
I experimented with changing .update() to .insert(), which works in the sense that both managers are listed as a potential approver. The problem is that the Request Item stands still until both approvals are received (Original Manager and any Escalated Managers).
We want to fix this so that any manager in the escalation chain can approve, and if any one person does approve, the remaining approvals are no longer required. Anyone have any thoughts or suggestions that might put me on the correct path?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2016 07:12 PM
I was reading up on workflows and remembered that workflows terminate the moment End is reached, so I came up with an alternate approach that should work very nicely, feels much cleaner, can be expanded upon and helps keep the process closer to being 'out of the box'.
First I created a new subflow called GetManagerApproval:
I then added the following variable to GetManagerApproval's subflow properties, which is assigned a yes/no value in the two run scripts (approved/rejected) just prior termination:
And then created an example workflow for the Service Request Item:
Double-clicking the GetManagerApproval activity, I set the 'Map to return value' to match the variable previously created (The If activity tests this variable for a yes/no, returned from the subflow, and acts accordingly):
It works perfectly whether I stop it at 1st, 2nd or 3rd level. And I figured there's a problem if you are having to escalate 3 or more times for approval. But if it should be needed I can simply add another layer or two into the subflow:)
Let me know if you have any questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2016 12:30 PM
Just updating the approver in same approval record - not sure how that would work. I am guessing you may face some issues with that approach. (not sure what though)
However, there is a way i can suggest without the knowledge of the workflow that is running behind -
After 2 days of no activity by current approver, DELETE the current approval OR mark the current approval as NO LONGER REQUIRED and insert new record for the same document id/task in approval table with current approver's manager as approver. (I am expecting the workflow can manage to go ahead in this scenario).
Let me know the constraints / limitations with this if any.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2016 12:45 PM
We shouldn't need to delete it. The script in place has worked flawlessly to replace the current approver with that persons manager, and restarts the workflow to generate the approval email.
But we want it to leave the original approver so that both can approve, with only one of them being required.
In other words, in the following scenario all we care about is that any one of the following 3 managers can approve, which renders the other 2 no longer required:
Manager 1 - Original Approver
Manager 2 - Escalated Approver after 2 days (Added via escalation script)
Manager 3 - Another Escalated Approver after another 2 days (Added via escalation script)
Example - If Manager 1 was on vacation, the approval escalates to Manager 2 and then Manager 1 returns from vacation, Manager 1 should still be able to approve and the Approval Request that was sent to Manager 2 should no longer be required once Manager 1 does so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2016 12:52 PM
Okay, cool in that case you can write a BR on sysapproval_approver table
WHEN: async/after update
CONDITION: state changes to "Approved/Rejected"
SCRIPT: query the syapproval_approver table for other approval record's existance for same Task, if they exists - change their states to 'No longer required'
You need to set proper condition to make sure, it doesnt affect approval records generated for other purposes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2016 01:00 PM
Thanks for the idea! I'll dig into that some more tomorrow and see how it turns out.
My only concern is that, in some cases, there are additional approvals requested once the generic Manager Approval cycle is complete, and I want to avoid mistakenly setting them to approved.
NOTE: All of our approvals are on the RITM's. No tasks are created until all approvals (Manager + extras) have been received.