Posted in Forms

How To Conditionally Trigger An Approval Step

Approval workflows typically are not just a fixed set of steps that get repeated every single time the flow is performed. Workflows need to be dynamic and route to specific steps based on data provided earlier in the process. For example, employees submitting expense reports for reimbursement usually require an approval from their direct manager but managers often have a limit on the dollar amount they can approve. An expense over a certain amount may need an additional approval by a supervisor.

With frevvo, this requirement is easily accomplished using preconditions. Preconditions are expressions that evaluate to true or false and can be defined for any step in a workflow. If the supervisor must also approve an expense report when the grand total is more than 1,000, the workflow can meet this requirement by attaching a precondition to the step:


When the first two steps (“Expenses” and “Reviewer”) are complete, frevvo will evaluate the precondition on the “Supervisor” step.  If the grand total is not greater than 1,000, the step is skipped and the flow advances directly to the “Accounting” step.

You can also use “ands” and “ors” to create more complex expressions. For example, let’s say the supervisor needs to approve anything over 1,000 but the president needs to approve anything larger than 10,000. You could change the precondition on the supervisor step to:

GrandTotal.value > 1000 && GrandTotal.value < 10000

What if you need an even more complex precondition? Let’s say supervisor approval is required if the total amount is over 1,000 or at least 1 line item is greater than 500. This problem can be solved by using a hidden calculated field and frevvo’s powerful but simple business rules.

Users can express more complex business rules in javascript: an incredibly powerful but easy language to start using. To solve this problem, a workflow designer could create a hidden field on the form called ‘ItemOver500’ and write a rule like:

Screen Shot 2014-09-08 at 5.52.08 PM

This rule will execute as the expense report is filled out. The rule initially sets the ItemOver500 value to “false” but then loops through all the amounts in the line items. As soon as an amount is found that is greater than or equal to 500, the ItemOver500 value will be set to “true”. Now with the rule in place, I simply change the precondition to:

GrantTotal.value > 1000 || ItemOver500.value = “true”

Double pipes (||) are used to indicate an “or” condition.

To summarize frevvo makes it easy to conditionally skip workflow steps even when the flow requires complex business logic to make the decisions.

Click here to view a short video about the expense report referenced in this article and here to read a full tutorial.

Leave a Reply