Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Preconditions add logic to your workflow to conditionally perform or skip steps based on the data entered into prior workflow steps. They are also used to generate/not generate mapped PDFs. The precondition logic is the same used when writing business rules. A step with a precondition will be performed when the precondition evaluates to true, and skipped if it evaluates to false.

Add a Precondition

You can add a precondition directly from your workflow diagram.

  1. Click theImage Modifiedicon where you would like to add the precondition.
    Image Modified
  2. Select Add precondition.
    Image Modified
  3. Configure the precondition. 
    1. Provide a Precondition Description, which displays in the workflow diagram. This field is limited to 255 characters, and it is optional. If the description is empty, the Precondition logic is described i.e. "LoanAmount is equal to or more than 50000". 
    2. Add the precondition logic. You must enter a valid precondition in order to click Submit. 
      Image Modified

Your precondition will appear in the workflow diagram as a yellow box with Yes and No arrows to illustrate how the workflow will route based on the precondition results. Click that yellow box to edit it.

Image RemovedImage Added

Edit the Precondition

...

  1. The Precondition Builder is turned on by default. Launch the Builder by clicking in the Precondition logic box or clicking the Edit button.
    1. Click the CLEAR PRECONDITION button to remove any existing Precondition logic, if needed.
  2. This editor uses a modified version of the frevvo Visual Rule Builder where you can build your precondition statement by selecting controls and conditions from the dropdown lists. Note the field drop downs (left and right sides) will not contain any repeating type fields (tables/repeats).
  3. Create the Precondition by selecting fields from your workflow, an operation and a value. To enter a literal value, slide the toggle to the right. Yo can add more than one condition by clicking on the Add Condition button and modify the logic expression, if necessary.
  4. Click OK to save the precondition or click CANCEL to discard. You will be prompted to confirm the cancellation.

...

  1. Slide the Precondition Builder toggle to the left to turn off the Builder. Be aware that taking this action will remove your ability to edit using the Precondition Builder. A warning message will display:
    1. Click the CLEAR PRECONDITION button to remove any existing Precondition logic, if needed.
  2. Type the JavaScript into the field.
    1. Changes to the precondition trigger code validation. Appropriate messages are displayed if errors are encountered. Errors with information display if the JavaScript is invalid.
    2. It is important that designers test the preconditions in your workflow. The Precondition Builder displays an error if it encounters invalid JavaScript, however, runtime errors such as leaving off the .value are not flagged by the Precondition Builder because the JavaScript is valid. For example, the precondition in the image is missing the .value for the Loan Amount field. This precondition will pass the Precondition Rule Builder validation but it will not work. will frevvo will catch this error when the workflow navigates to Step 2. To correct the runtime behavior, change the precondition to LoanAmount.value >=500000

Update Business Rules

If you have rules that operate on the step that may be skipped due to your precondition, such as show/hide a signed section, you must update the business rule to add the same condition you used in your precondition logic. 

For example, imagine you have created a 3-step approval workflow using the Workflow Design Wizard.

Image Added

The wizard included a signed section and rules to show/hide them on their corresponding steps. 

Image Added


Image Added

Next, add a precondition on Step 2.

Image Added

Run the workflow with the precondition not met so that Step 2 is skipped. You will notice that on Step 3, the signed section for Step 2 is required but not enabled, so you cannot submit the workflow. This happens because the rule "On or After Approval Step (Step 2)" is setting the Step 2 approval section visible. When a signed section is visible, it is automatically required. However, the rule "On Approval Step (Step 2)" is setting the same section to disabled on the third step, so you cannot sign it. 

Image Added

To correct this, we should edit the rule "On or After Approval Step (Step 2)" to have two conditions: the original "current step is on or after" condition, and the same condition that your precondition uses. Image Added

Run the workflow again just as before. This time, when the precondition fails the Step 2 approval section will not be visible on Step 3, and you will be able to submit the workflow.

Image Added

Though this often occurs with rules to show/hide signed sections, you may find that other types of rules that run on or on and after a step with a precondition also require this additional condition that matches the precondition logic.

More Info

If you have an existing precondition that was manually entered into the Precondition Code field when the Builder was turned off (code mode), slide the  to the right to turn the Builder back on. The existing code will be removed but the Precondition Builder will be available again. You will see this message:

...

Preconditions can be used to implement a Reject to Discard scenario as an option for rejecting workflow tasks. Let's say you want to note that a workflow task is rejected (not approved) but still have the form stored as a completed submission in the repositoryfrevvo repository. Adding preconditions that evaluate to true to later workflow steps will cause those subsequent steps to be skipped and the workflow will complete. The workflow will be saved in the submission frevvo submission repository with some customized indication that the workflow step was rejected. See the Reject to Discard RejecttoDiscard topic for the details and an example.