Studio business rules

Business rules are the building blocks from which the business logic of a workflow is constructed. You can define business rules for records, processes, metaphases, phases, and transitions.

The following categories of business rules are available:

For each rule defined, there is also an Include condition option, which enables you to define a condition that must be satisfied for the rule to be executed.

Some out-of-the-box business rules are provided in the existing workflows, which you can edit. You can also define new business rules. For more information about adding a business rule, see How to add a business rule.

Defining business rules in a workflow

Business rules can be defined at each level of a workflow:

  • The record type level

  • The process level

  • The metaphase level

  • The phase level

Record type. Select the record type from the drop-down box at the top of the screen and select the Processes and Rules tab. In the left pane, select the record type name (the top level of the tree). The tab displays the business rules defined for this record type, across all of its processes. Record types are provided out-of-the-box and cannot be customized.

Process. In the left pane, select a process (the second level of the tree). The Properties tab on the right displays the properties for the selected process and the Rules tab displays the business rules defined for the process, across all its metaphases. The processes are unique to the records and are consumed as workflows in the application.

Metaphase. The Processes and Rules tab displays a workflow map for the selected process, which contains a fixed number of metaphases. Click one of the metaphases (at the top of the map) to select it. Alternatively, in the left pane, select a metaphase (the third level of the tree). The Properties tab on the right displays the properties for the selected metaphase and the Rules tab displays the business rules defined for the metaphase, across all its phases. The metaphases can be customized.

Phase. The phases are represented by the rectangles in the workflow map. Select a phase and a popup menu appears which enables you to move or delete the phase, or to add a transition or another phase. Alternatively, in the left pane, select a phase (the fourth level of the tree). The Properties tab on the right displays the properties for the selected phase and the Rules tab displays the business rules defined for the phase. The phases can be customized.

You can also define business rules for transitions:

Transition. The lines between the phases in the workflow map represent the transitions between the phases. Select a transition and a popup menu appears which enables you to move or delete the transition. Alternatively, in the left pane, select a phase (the bottom level of the tree). The Properties tab on the right displays the properties for the selected transition, and the Rules tab displays the business rules defined for the transition.

Business rule properties

To view the properties of a business rule, click Edit and select Rule properties. The Rule properties dialog box opens, displaying the ID of the rule, the last time the rule was edited, and the name of the last user to edit the rule. For locked rules, click the lock icon and select Rule properties to view the rule ID.

Note  

  • For rules last updated before March 2016, the specific date and time of the update is not available.
  • Rule IDs for out-of-the-box rules generally are descriptive of the rule, for example, calculateResourceDemands. User-defined rules are assigned random IDs.

Business rule syntax

Each business rule contains at least one parameter, which you set when selecting the rule template. The parameters in the selected rule template are links. When you click a parameter, an edit box opens.

For some parameters, you select the required value from a drop-down list. For others, you can enter free text. There are a number of parameters for which there exist two possible methods for entering data: Simple mode and Expression Language. In Simple mode, you enter free text or select from a list, according to the data type. In Expression Language, you enter a phrase using the Expression Language. For more information about the Expression Language, see Expression Language.

Click the Expression Language button to toggle between these options. When the button is selected (green), the field is in Expression Language mode. When it is not selected (white), the field is in Simple mode. For a full list of Expression Language functions, see Expression Language functions and syntax.

For more information about setting rule parameters, see Validation rule examples, Action rule examples, Rendering rule examples, and Field selection rule examples.

Note  

  • If the Expression Language phrase references a field from the record, you must add a condition to the rule that validates that the field has been filled in. For example, if you reference the AssignedGroup field, you need to include this expression: ${entity.AssignedGroup != null}.

  • Encrypted fields cannot be added to business rules.
  • If you have defined rules of a type that has been deprecated, you can continue to edit the existing rules, but you cannot define new rules of the deprecated type.

Process events

Rules are defined to be executed in connection with specific events. The event determines when the rule is executed.

In the Rules tab for workflows, processes, metaphases and phases, you can define rules in connection with the following process events:

Process event Description
Before change The rule is executed before any user changes are applied. Used, for example, to set default values.
After change The rule is executed after the data is updated. Used, for example, to run validation rules.
Rendering forms The rule is executed when a form is opened.
After applying changes

The rule is executed after the change is committed. Used, for example, to run external operations such as sending notifications, updating related records, and so on.

The key difference with the After change process event is the order in which the events are resolved. The order is After change, then changes are committed, then After applying changes.

For more information, see Process events order.

Entering The rule is executed when entering the selected phase.
Leaving The rule is executed when leaving the selected phase.
Before deleting The rule is executed before the record is deleted.
Before removing relationship The rule is executed before a relationship to another record is removed.
Before adding relationship The rule is executed before a relationship to another record is added.
After adding relationship The rule is executed after a relationship to another record is added.
After removing relationship The rule is executed after a relationship to another record is removed.
Per schedule The rule is executed according to the specified schedule.
SLT Event

The rule is executed when the Service Level target duration reaches the 0%, 50%, 75%, 90%, or 100% level of the target, as defined by the rule.

This process event is relevant for incidents, requests and the customized record types created in Studio only. For information on defining business rules under the SLT Event process event, see How to add Service Level Target event business rules.

Not all of the process events are relevant for each of the workflow levels. For example, Entering and Leaving are relevant for the phase, metaphase, and process levels, but not for the record type level.

When defining a business rule on a transition, there is only one process event option: During transition. The rule is executed when the transition occurs.

For process events with existing business rules, the number of rules appears in red next to the event name. Click the process event to expand it and view the rules.

System rules

There are business rules that appear under the process events out-of-the-box. Some of these are System rules which are specific to each module, and are not editable.

Process events order

Several of the process events are related and occur in a specific sequence. The order of the process events can be significant when choosing the event with which to define a business rule.

If a data update to the record occurs in conjunction with a phase change, the following occur in the indicated order:

Graphic showing order of process events

Note When transitioning from one phase to another, the phase change occurs before the transition. Thus, the business rules defined on a transition relate to the next phase (the PhaseId field of the record contains the value of the phase at the second end of the transition).

The process events connected with relationships represent a separate flow. When adding a relationship, the order of events is:

When removing a relationship, the order of events is:

The Before deleting, Rendering forms, and Per schedule process events, do not occur as part of a flow.

Related topics