Soft Validation Popup in IBM BPM

When it comes to doing validations in IBM Business Process Manager (IBM BPM) it is usually sufficient to use the standard techniques of the CoachValidation framework. But what if you only want to warn the user and give them the option to either review their input or continue anyways? How can this be modelled?

In this example we have a Coach where the user can enter input for three Decimal fields. If any of the Decimals is empty when the user hits Submit we want to open a modal window which warns the user. Below you can see the Coach Step 1 with the Decimal controls, a Submit button and the Dialog (from the Dashboards toolkit).

To control when the Dialog is shown we need a Boolean variable showWarning. The text in the dialog is filled dynamically and stored in the warningMessage String. Together with the Decimals the variables in our Heritage Human Service look like this:

The showWarning variable is initialised in the step Prepare Coach right before we enter the Coach.

The full diagram looks like this:

When the user clicks Submit the validation is executed. In case the validation was successful the flow continues to the Show Warning step. This contains the logic for the “soft validation”. While the Validate script contains blocking validations as usual (such as required fields which are empty), the Show Warning script contains the logic for showing the warning dialog (e.g. if any of our optional Decimal fields is still empty).

If this “soft validation” results in the warning dialog needing to be shown the showWarning variable is set to true and the Show Warning? gateway leads to a stay on page instead of continuing to the next Coach Step 2.

Now the user is presented with the warning dialog and can choose to either Submit anyway, which will lead the process flow to Step 2 (as if the warning had not appeared), or they can click Review input which will cause the user to stay on the page and close the dialog by setting showWarning to false in the Close Warning script.

This results in a “soft validation”, this case checking whether the optional Decimals fields were set at all.