Rewinding Instances
Rewinding a Process Instances
A BPMN process diagram defines how a process should work – but occasionally unexpected things (or users) happen, and a process takes the wrong path. Rather than terminating the process and starting again, Flows for APEX allows an administrator to rewind the process to earlier positions on the process diagram.
A process instance must be suspended prior to being rewound. After rewinding, process execution can then be resumed. See further details on Suspend and Resume.
Editions: The Suspend, Rewind, Resume functionality requires the Flows for APEX Enterprise Edition.
Rewinding a Process
Rewinding paths in a suspended process instance allows an administrator to reset a process to a better position after it takes an undesired path, without having to terminate the process and start again. While your BPMN model determines how the process should work, sometimes unexpected data or incorrect decisions lead to unforeseen results. Rewind gives you the ability to fix some of those situations.
[!CAUTION] To fully use rewind, you should have a good understanding of how Flows for APEX uses subflows, and how subflows are created and used in different BPMN objects. You should be familiar with the material in About Subflows. It is also recommended that you familiarize yourself with the various rewind options by experimenting with rewinding test instances of your model; you can also experiment with the tutorial models - particularly with a complex model like Tutorial 8a - The Full Monty.
Rewind allows you to set the process state so that different objects are current. As administrator, in addition to rewinding the workflow engine state, you may also have to unapply / fix / edit the systems of record that rewound transactions altered.
Rewind provides a set of tools to rewind certain process structures back to an earlier state. You might need to apply one or more rewind operations to get to your desired process state. The following rewind operations that are provided:
- rewind to a previous step on the same subflow (details)
- rewind to the last gateway (details)
- remove a subflow (details)
- while waiting at a merging gateway, return to the immediately prior step (details)
- rewind out of a sub process, returning to the calling object (details)
- rewind out of a call activity, returning to the calling object (details)
- rewind across a link event (details)
Rewinding - General
To rewind or reposition a subflow, use the Subflow Actions menu > Rewind Actions > action menu in the Flow Monitor Details page of the Flows for APEX application.
Rewind to a previous step on the same subflow.
Use case: Rewind to a previous step can be used to return the current step on a subflow to an earlier step on the same subflow.
For example, in the diagram below, this could be used to go:
- from step A2 to A1
- from step E2 to E1
Restrictions:
Rewind to a previous step cannot be used:
- to rewind beyond any gateway object
- from a merging gateway
- through a boundary event
- across a link throw event - link catch event pair
Resulting State:
After the rewind:
-
the previous current object will not be marked as completed
-
the target object will be in status
restart on resume
and will be marked as the current object in the viewer -
the rewind activity will be logged if logging is enabled at
abnormal events
(level 2) or more detailed.
How to:
-
Select the subflow that you wish to rewind, then using the row level menu, select Rewind Actions > Rewind to Earlier Step.
-
In the pop-up window, select the target step. You can use the pop-up list of valid target steps.
-
Optionally leave a comment for the log justifying your rewind.
-
Click Reposition Subflow.
Which results in our process now rewound to step E1.
Delete a Subflow
Deletes a subflow from the process.
Use Case: Use this to remove one of the parallel paths in a parallel section following a parallel gateway or an inclusive gateway. In our example, we could remove the ‘C’ path that includes tasks C1 and C2.
This could also be used to remove a subflow following from a non-interrupting boundary event, for example, the reminder path following a non-interrupting timer boundary event.
Resulting State:
- Any parallel sections (between pairs of parallel or inclusive gateways) will still merge correctly without further action.
- Any completed tasks are still marked as
completed
. - The subflow will be in status
delete on resume
, and will be deleted when the process resumes. - The rewind activity is logged into the instance log if logging is enabled at
abnormal events
(level 2) or more detailed.
How to:
-
Select the subflow that you wish to rewind, then using the row level menu, select Rewind Actions > Rewind to Earlier Step.
-
In the pop-up window, select the target step. You can use the pop-up list of valid target steps.
-
Optionally leave a comment for the log justifying your rewind.
-
Click Reposition Subflow.
resulting in:
After resuming, our process now has subflow C deleted:
Return to Previous Gateway
Return to previous gateway, as it says on the can, returns to the previous gateway. What that actually does depends on where the requesting step is.
- if the requesting current step is inside a parallel structure (following an inclusive or parallel gateway), all of the parallel paths are removed, leaving only the opening gateway object as a current object
- if the requesting current step is the merging gateway at the. end of a parallel section, the new current step is the opening parallel or inclusive gateway of that section.
- if the requesting step follows a closing gateway, the new current step is that closing. gateway.
- if the current requesting step follows an exclusive gateway, opening or closing, it returns to that gateway
- if the current requesting step follows an event based gateway, the new current step becomes the event based gateway
If control returns to an opening gateway that is data driven, you can return to the opening gateway, change any process variables as required - including the variables used to control the gateway, and then resume. Resuming from a gateway object results in the gateway stepping forward using the new variable data into your corrected path.
Use Case: Often the simplest way to rewind a process when it takes the wrong path is to return to the gateway where it went wrong, change the controlling variable, and re-execute the gateway.
Resulting State:
- Previous gateway becomes the new current object
- Any paths parallel to the requesting path will be marked for deletion
- Any steps that were completed, forward from the previous gateway, will still be shown as having been
completed
. - The rewind activity is logged into the instance log if logging is enabled at
abnormal events
(level 2) or more detailed.
Example 1: Rewind to Previous Gateway inside Parallel Structure.
We notice that the process is proceeding on paths A and C and after investigating the problem, discover that incorrect data was used to choose paths A and C. It should have picked routes A and B. How do we fix this without restarting?
Let’s suspend the instance, and then rewind to Previous Gateway from C2. Here’s or starting position.
Rewinding to previous gateway from C2 gets us back to ‘Choose ABC’ gateway.
- Paths A and C become
delete on resume
status - Gateway ‘Choose SBC’ becomes the current object, with status of
resume on restart
Now reset the process variable used to drive the inclusive gateway ‘Choose ABC’ to ‘A:B’
And resume our process. Here it is after resuming…
Example 2. Rewind to Previous Gateway outside Parallel Structure
We’ve arrived at Task F, but realize that path B was omitted due to bad data at ‘Choose ABC’. How do we go back to include path B?
We are already outside the parallel section ADE and its inner parallel section ABC. All of the parallel structures have been deleted - so we have to go back to Gateway ‘Split’, reset the variable that is used to control the Inclusive Gateway ‘Choose ABC’, and then resume.
So suspend the process, selecting subflow containing F
, and rewind to previous gateway, returning us from Task Force to the merging gateway.
Selecting the subflow containing Merge
, we rewind to previous gateway again, this time returning us to split
.
Now reset the process variable used to drive the inclusive gateway ‘Choose ABC’ to ‘A:B’
And resume the workflow.
Rewind to Last Step while Waiting at Gateway
One of our paths has completed, and is waiting at a gateway for other parallel tracks to complete before proceeding. We want to step backwards on that path to repeat a task that didn’t execute correctly.
Use Case: Used only for paths that are in waiting at gateway
status at a merging gateway.
Operation:
Suspend the process instance, then select the subflow that is waiting at gateway
. Using the row-action menu, select Rewind Actions > Rewind to Last Step.
The rewound subflow is now marked with status restart on resume
. Either the process can be further rewound from here, or resumed.
Rewind Out of a Sub Process
If a process instance is running inside a sub process and you want to rewind to a step before the sub process became current, you need to rewind out of the sub process.
If the sub process contains gateways and nested structures, you should first use the standard return to an earlier step and return to a previous gateway commands to get to the top level inside the sub process.
Looking at an example, processing on our process is currently on task Task C1
and inside sub process E2
. If we drill down into sub process E2
by clicking on the blue icon, we can see that Task E2A
has already completed and Task E2B
is the current task.
Start by suspending the process instance. Our current task, Task E2B
is in the top level of the sub process – so we don’t need to rewind inside the sub process. We want to rewind from the sub process.
Select the subflow with Task E2B as its current object. In the row actions menu, select Rewind Actions > Rewind from Call Activity.
Looking now at the resulting process, the process looks similar to before we rewound – but looking carefully and drilling down to the sub process, you can see that the current object is now the sub process itself, in the parent process, and that the sub process has no current object.
and the sub process:
Now rewind to earlier step to Task E1
. Subflow is still in restart on resume
status.
And resume the process, leaving the process out of the sub process and on the previous step.
Rewind Out of a Call Activity
If a process instance is running inside a call activity and you want to rewind to a step before the call activity became current, you need to rewind out of the call activity.
If the call activity contains gateways, nested structures, and sub processes, you should first use the appropriate return to an earlier step, return to a previous gateway, and rewind out of a sub process commands to get to the top level inside the call activity.
Then rewind from a call activity works similar to the rewind out of a sub process procedure detailed above.
Rewind Across Link Events
If your process diagram has used Link Throw Events ( ) and Link Catch Events ( ) to simplify your drawing layout, you will need to be able to traverse the link when you rewind the process.
Flows for APEX saves a breadcrumb in the subflow log so that you an rewind across a link. In the event that you have multiple throw events linking to a single catch event, rewind will always return you to the throw event that was used during the process execution.
In the following situation, path G was taken, and Link G2
walked – so that our G path is now waiting at the Gateway Merge
. To rewind the process to step Task G1
, we need to:
- suspend the process instance
- Our G path is currently
waiting at gateway
so we need to use the specialrewind to last step from gateway
to get back to theLink G2 Catch
event, as below.
Now we use the Rewind to Matching Link Event to rewind to the Link Throw Event.
Then rewind to earlier step to get back to Task G1
. and then resume to resume executing the process instance.