Monday, January 11, 2021

New workflow capabilities in Orbeon Forms 2020.1

Orbeon Forms 2020.1 introduces a number of tools that make it easier to handle situations where you have a workflow around a form that involves multiple people who may be able to do different things, at different times, depending on a number of conditions.

Let's illustrate this with the example of an expense report, say:

  1. Employees can fill and submit new expense reports.
  2. Managers can review, but not edit, submitted expense reports, and either approve or reject them.
  3. If rejected, the employee who initially submitted the expense report can edit and resubmit it for approval.
  4. If approved, the expense report is marked as such, and becomes read-only.

An actual use case is most likely going to be more complicated than this, but this will suffice to illustrate the capabilities we want to discuss here.

Example of an expense report workflow, with stage transitions

First and foremost, Orbeon Forms 2020.1 introduces built-in support for the concept of stage. Our expense report can be in one of the following 3 stages: submitted, approved, and rejected. Looking again at the above workflow with those stages in mind:

  1. Employees start to fill an expense report, and submit it, at which point the stage becomes submitted.
  2. Managers can review expense reports with a submitted stage, and use the Approve button to change the stage to approved, or the Reject button to change the stage to rejected.
  3. If rejected, the employee can edit the form, submit it again, which changes the stage back to submitted.

This illustrates that stages can change with buttons at the bottom of the form, which brings us to a new workflow-related feature in Orbeon Forms 2020.1: the ability to change the stage with the set-workflow-stage(name = "…") action in a process, a process being the sequence of actions that runs when a button is pressed.

Finally, a combination of who the user is (an employee or a manager) and the current stage has an influence on what users can see and do, that is, whether they can edit the form, and what actions on the form are available to them. So you can implement those restrictions, Orbeon Forms 2020.1 introduces the fr:workflow-stage-value() function, which allows you to know what the current stage is. You can use this function anywhere you can use formulas, and in this example you can use it to:

  • If the user is a manager and the stage is submitted:
    • Show the Approve and Reject buttons.
  • If the user is an employee and the stage is different than submitted and approved:
    • Show the Submit buttons.
    • Allow users to edit the fields in the form.

To make this last item easier, Orbeon Forms 2020.1 introduces a form-level formula allowing you to set the whole form as read-only if a given condition is met. It was already possible to make specific fields or specific sections read-only, and it is now possible to do the same for the whole form, so you don't have to repeat the same formula on each section of the form.

Those are powerful tools, and we have even more workflow-related improvements in the works for future versions of Orbeon Forms, in particular to expose some of those features in Form Builder so they can be used more easily. We hope you'll find this useful, and are looking forward to seeing what you build using those new capabilities.

No comments:

Post a Comment