Skip to main content

Dealing with exceptions

Dynamic injection of a process

Even the best designed process can’t handle everything

In an ideal world, you design a process and all works perfectly. In the real world, stuff happens that no one anticipated when the process was designed, or some instance has to be treated as a special case. Flowable has a capability of injecting new process elements into a running process instance. Not just for the cute sales demo, but also for the gnarliest of complex, real processes.

In this cute sales demo, we’re using a feature of Flowable that allows Actions to be available for the user within a FlowApp - using an Action model rather than a process or case model. The demo app has an Action defined on user tasks that injects a specific process definition into the process instance at that step. The Action is available from the actions menu as Add identity check.

Inject Process

Select this action now and say OK to confirm it. Nothing appears to have changed, but what’s actually happened is that a process for requesting additional identification has been inserted into the current process in parallel. This means that even if this task is completed, the original process will not continue until the injected process has run. The injected process has a couple of user tasks in it. Click on the Loan case link in the task header to see the open tasks.

Injected Task

There is now a task to Attach identification. Select that task and you’ll see a form requesting a Document image. Click and browse to the Photos folder in Examples and choose a photo to upload. You’ll then see that you’re also required to specify a content type for the upload.

Content Type

Click on the content type drop-down and select one. You can control what content types should be available as well as if a content type is required. This allows you to make sure you collect the appropriate properties for a file when it’s uploaded.

List of Types

Pick the Driving license content type and pick a date and fill any other fields.

License Type

You can now complete the task. You’ll notice that there’s still two tasks open for the case, as the identification process has an additional step to review the identification just uploaded. Before moving on and reviewing the ID, let’s show that the process does really get held up until the injected process has done its extra bit. Select the Review application task.

Review Application

Click the Complete button and you’ll notice the process doesn’t move on to ask for the manager details to be given. That pesky Review identification task has to be completed first. Select it and you’ll see the details to review; you can also view the file properties that were added.

ID Review

Select the Accept outcome button and the process will now move on to the Assign manager task. You can run through the rest of the process and case to completion (hopefully it’s familiar enough to do yourself now).