Example 3

A request type has Start date and Finish date fields. You want to prevent users from specifying a Finish date value that is earlier than the Start date value provided on a request of this type, and highlight these fields whenever the rule is violated.

To accomplish this, do the following:

  1. Create an advanced "Apply on field change" rule with two dependencies: start is after finish, and finish is before start.

    Rule logic: showMessage('Finish date cannot be earlier than the Start date. Please fix before saving.', false)

    A change in either the start or the finish date will trigger this rule.

  2. Create an "Apply on field change" rule that sets the border of the date fields to red.

    Rule logic: setFieldStyle("redBorder")

    where the RequestRulesUserCSS.css file contains:

    .redBorder { border:2px solid red }
  3. Create an advanced "Apply before save" rule with one dependency: start is after finish.

    Rule logic: showMessage('Finish date cannot be earlier than the Start date. Please fix before saving.', false)

    Note: This is the same as the field-change rule from step 1.

  4. To keep the red border on the date fields whenever this request displays information that violates the date rule, create an "Apply on page load" rule to set the border of the date fields to setFieldStyle("redBorder").

    The borders will be shown every time you view the request, if the condition is met.