Setting Up Business Rules

– Administrator function –

Business rules enforce constraints, provide pop-up messages, send email notifications, and perform other actions based on assigned conditions. Business rules usually paint a workflow picture; for example in Safety an incident approval process workflow is defined by a collection of business rules.

Clients may alter or add business rules so Cority works with their organizational workflow.

Default business rules are identified (in the Details section) as “Cority Created” and cannot be deleted. These are listed in the System Guide. Rules that are critical to Cority’s operation are identified as “Essential Functionality” and cannot be inactivated.
An administrator can migrate business rules from one environment to another; see Migrating Configurations.

  1. To view the business rules defined in Cority, in the Administrator menu click Business Rules. The list displays the code, description, rule type, entity, and active status.

  2. Business Rule layouts include two Show Record History actions:
    - Show Record History (Details) displays the standard header changes.
    - Show Record History (Conditions) displays a log of each time business rule conditions were added, deleted, or changed.
    The Show Record History action on the Action List tab displays each time a user unlinked a business rule action from the business rule.

    To export business rules to a JSON file, select the rule(s) on the list view and then choose Actions»Export Business Rule Configurations. Conversely, you can import a JSON file to create business rules. By default, Update existing records will be toggled off. If you want existing records to be updated upon import, you must toggle the setting on before selecting a file for import. You cannot import/update a Cority-created business rule.
    To copy a business rule, open it and choose Actions»Clone.

  3. Click a code to open an existing rule, or click New.

    Admin_bus_rule.png
  4. In the Details section, enter a Code and Description, select the Entity for which the rule will apply, and enter a Priority for the rule. The priority can be any integer, and determines the order that the rule is processed if there are multiple rules. Lower number priorities are processed first.

  5. In the Conditions section, define the business rule:

  6. To remove a condition, click the X at the end of the row.

    By default, multiple conditions for the same property are treated as OR. Conditions for different properties are treated as AND. For example:

    1. Country, Equals, Canada
    2. Country, Equals, USA
    3. Sex, Equals Male
    4. DateOfBirth, Less Than, January 1, 1978

    ... would be evaluated logically as:
    (1 or 2) and 3 and 4

    The numbers correspond to the row numbers assigned to each condition. The default logic can be overridden in the Advanced Conditions field by using the row numbers to identify the individual conditions, e.g.
    (1 and 3) or (2 and 4)

    If the field must start with a specified value for the rule to fire, select the Before Update check box. In the following example, six conditions have been created for the Campaign entity:
    - If a user changes the Short Description and clicks Save, the system will check the previous value before updating it.
    - If the previous value was “Phase 1”, the user will only be able to change the value to “Phase 2” (conditions 1 and 2 and 3).
    - If the previous value was “Phase 2”, the user will only be able to change the value to “Phase 3” (conditions 4 and 5 and 6).

    Admin_bus_rule_conditions.png

    If date fields are used in a condition, they can separately be specified as Before Update or not (for example, date of termination (before update) is less than date of hire (after update)). However, if Before Update is used on either (or both) of the date fields, “Update” is the only trigger that can be used in the business rule.

    Admin_bus_rule_conditions_dates.png

    You can include Query Builder/Report Writer queries in business rule conditions to associate entities that are not already linked. Set up the query and flag it as a Subquery (see Working with Ad Hoc Reports), then identify it in the business rule with the “Is Contained In” operand. You can also configure a subquery used by a business rule to filter by one or more of the rule entity's fields; the business rule will fire only for the configured field filter.
    Examples of business rules that use a subquery:
    - For an incident that resulted in a death, at least one witness must be provided.
    - A clinician must be alerted when working on a clinic visit for an employee who has been diagnosed with influenza.
    - A risk assessor must be alerted when the agent is a dermal skin notation.
    You can configure a business rule condition to assess the value of a subquery, e.g. ‘Subquery Y’ ‘Greater Than’ ‘75’. When the subquery runs, the 'first row, first column' is checked for a value, and that value is used for the condition's evaluation (the assumption is that the 'first row, first column' of the subquery is a number).

  7. In the Trigger section, define where and when the rule will fire.

  8. If the Before Update check box is selected beside a Condition above, Update will be selected in the Trigger section and the other check boxes will be disabled.

    The Rule Type determines the kind of rule you are creating:

  9. Use the Action List tab to specify actions to be performed when the rule is fired successfully. Click the icon to add an existing action, or choose from the Actions drop-down to create a new action for the rule. For more information, see Setting Up Business Rule Actions.

You can force any Change, Method, or scheduled Email actions to be run for any relevant records without waiting for the trigger; on the Business Rule tab, choose Actions»Add actions to queue for records matching conditions. When you choose this action, all immediate email or scheduled email actions, as well as immediate change or method actions, will be added to the queue.
For Change or Method actions, you will see the list of records that match the criteria specified in the business rule; select the desired records and then click Add to queue.
For Email actions, you will see a list of the available time-driven BRAs (BRAs for which the scheduled execution time is in the past are displayed but cannot be added to the queue); select the ones you want to run and then click Add to queue.
To view the queue, see Monitoring the Business Rule Action Queue.