Flow Designer: Custom Escalate Approval when the pending approver can't
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2023 09:02 AM
I'm looking for a way to replace a pending approval for someone that temporarily can't. And just to limit the distractions, Delegate is time based and is for all approvals unless you have a trick. In my case, it's more like Escalate Approval for a single RITM. Currently, we have a UI Action on the approval that pops a UI Page, and that sets the new approval you pick. It replaces the existing approval and then updates wf_context to wait for the new approval and also creates the event to notify. However, none of this works when Flow Designer is the context. The 'Ask for Approval' action hangs for single approval as it can't see the new approval. I can get a group approval to work by just replacing the sys_user.sys_id of the approval record and call the notify event. If I change anything else it breaks.
Some traps, if I create a new approval, FLOW can't see it. I can't update or create the listeners or the record watcher as every time I touch them I break it. On a group approval, I can sneak in and just flip the sys_user id on a sysapproval..table. however if it's just a hard coded approver in the flow for one person, changing the id doesn't work. It looks and approves like it should but Flow doesn't see the approval and I can't find a way to force it, like, sn_fd.FlowAPI.nudgeFlowsWaitingOn()
I can't go and change 100's of Flows to use an OR Manual approval. The FlowAPI() can't change the running context 'Ask for Approval' and any attempt to change the table records looks to break the listeners.
These are the records I know of.
Escalate approval:
1 - find sysapproval
2 - find sys_flow_approver_listener_reference and sys_flow_listener
3 - insert sysapproval
4 - insert sys_flow_approver_listener_reference to sysapproval record (must use the same context sys_flow_listener)
5 - insert sys_rw_action to connect it all together
6 - mark the old sysapprovals as no longer needed without moving flow.
Result should be - when the new approval happens the sys_flow_approver_listener_reference/record watcher will tell the flow context action (via sys_flow_listener/event 'flow.fire') that approval happen and 'nudge' flow.
This may be all wrong as it doesn't work. If anyone has some wisdom or insight on what FLOW wants, I'd enjoy that very much. I've tried a lot of ways and have nothing.
On San Diago now but Utah in a few weeks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2023 11:50 AM
I surely hope that you have found an answer for this since April, but I am adding this info here in case you still needed help, or anyone else finds this when searching for something similar.
As stated, if someone needs to have an approver change for a flow designer flow that is already in progress, you cannot just change the name on the existing approval record (the way that you could for the old workflows). If you do, the flow will not advance and will stay stuck waiting for approval even if the new person approves the record.
We have implemented a workaround for this problem that was provided with an update downloaded from the store. It worked great for us.
Description: Created a UI action on sysapproval_approver record to create a new approval record and update the current approval record.
This UI action enables approvers to be updated in flow designer.
Update set contains:
UI Action Update Approver (table: sysapproval_approver)
UI Page update_approver_dialog
Flow Update Approver
Script Include SubflowUtils
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2023 07:28 AM
Shannon,
I did get a working solution on Utah. San Diago didn't work, same solution, so SN had to have make some changes to the SN Code we can't get to. In San Diago, any changes to a single approval would allow the flow to hang (no move when approved). However, a group approval would work if you just change the approver sys_id on the sysapproval_approver record. So, depending on how the approval was created, group, multiple groups, single approval or manual approval it would ether work or hang.
Once we upgraded to Utah I did revisit it and found the same script that didn't work in SD now worked perfect.
My solution is a tiny bit different as I started in SD and didn't recode when I found it worked.
UI action to Escalate.
UI Page to get the new approver (mgr's in sys_user), default to manager of current approver.
Script to get current approver. I put mine right in the UI Page.
- Copy the record to memory/var. You need it later.
- Update current record, change approver sys_id to the new manager. setworkflow and SysAuto to false so the SNC code sees nothing and save it/Update().
- Change the copy record, set to no longer needed and Insert it as new record, no WF, no SysAuto. I think I add a comment about escalated as well. Else just post worknote to the RITM so it's clear what happened.
- If nothing errors in your try catch at this point, Queue an event to notify the new approval and pass in the sys_id of the original record and it will send the notification.
- Any Error, rollback and clean up the mess, Pop an error message that Escalation failed and why.
- redirect back to the current record so it shows the new approver.
If you check the RITM, you see the new pending approval and the old approval as no longer needed. Flow designer don't know anything changed so when the approval happens it moves. This is exactly the same as San Diago only it didn't work in that version. My guess is all the PRB tickets for hung approvals and the NudgeFlow() script that SN made for this very reason was actually fixed in the backend.