Creatio development guide
PDF
This documentation is valid for Creatio version 7.10.0. We recommend using the newest version of Creatio documentation.

Setting the edit page fields using business rules

Glossary Item Box

One of the tools for setting the page logic in bpm'online is business rules (or rules).

Rules are a standard mechanism of the system that enable the designer to add the typical functionality implementation by configuring the view model columns.

This means that there is no need to write additional user methods for solving typical tasks. It is enough to configure columns using the rules.

Rule functionality is realized in the BusinessRuleModel client module. To use this functionality, the BusinessRuleModule must be added to a list of user module dependencies.

Example 1. — Adding the BusinessRuleModule module to a list of dependencies

define("CustomPageModule", ["BusinessRuleModule"],
    function(BusinessRuleModule) {
        return {
            // Client module implementation.
        };
    });

General procedure for declaring rules:

  • All rules are described in the rules property of the page view model.
  • The rules are applied to the view model columns, but not to the management items.
  • The rule has a name.
  • The rule parameters are set in its configuration object.

Example 2. — Procedure for declaring rules

// List of all rules of the view model.
rules : {
    // Column name, for which the rule is added.
    «FirstColumnName» : {
        // The list of rules for the FirstColumnName column.
        // Rule name.
        FirstRuleName : {
            // Configuration item of the FirstRuleName rule.
            ruleType: <a value from the BusinessRuleModule.enums.RuleType>
            // Other configuration properties of the rule.
        },
        SecondRuleName: {
            // Configuration item of the SecondRuleName rule.
            ruleType: <a value from the BusinessRuleModule.enums.RuleType>
            // Other configuration properties of the rule.
        }
    },
    «SecondColumnName» : {
        // The list of rules for the SecondColumnName column.
    }
}

The types of bpm’online rules are listed in RuleType of the BusinessRuleModue module.

There are 3 types of rules defined:

1. BINDPARAMETER 

The BINDPARAMETER is used to bind the properties one column to values of various parameters. For example, to set the column visibility or accessibility depending on the other column value.

Configuring the BINDPARAMETER rule

Property Value
ruleType

Type of the rule.

The ruleType is set using a value from the BusinessRuleModule.enums.RuleType list.

The BINDPARAMETER type is used here.

property

Property of a management item.

The property is set using a value from the BusinessRuleModule.enums.Property list:

  • VISIBLE —column visibility;
  • ENABLED —column accessibility;
  • REQUIRED — filling required;
  • READONLY — the read only column.
conditions

Array of conditions for a rule application.

Each condition is a configuration object described below.

logical

Logical operator for combining conditions from the “conditions” property.

The logical property is set using a value from the Terrasoft.LogicalOperatorType list.

Configuring a condition of the BINDPARAMETER rule

Property Value
leftExpression

Expression of the left part of a condition. The leftExpression is a configuration object with the following properties:

  • type — a type of expression. The type is set using a value from the BusinessRuleModule.enums.ValueType list:
    • CONSTANT — the constant;
    • ATTRIBUTE — a value in the view model column;
    • SYSSETTING — a system setting;
    • SYSVALUE — a system value. Item of the system value list Terrasoft.core.enums.SystemValueType.
  • attribute – the name of the model column;
  • attributePath – the meta-path to the lookup schema column;
  • value – a value for comparison.
comparisonType

Type of comparison.

The comparisonType is set using a value from the Terrasoft.core.enums.ComparisonType list.

rightExpression Expression of the right part of the condition (like as leftExpression).

2. FILTRATION

Filtration of the view model column values is used to find a specific lookup type column depending on a value of the current page status, for example.

Configuring the FILTRATION rule

Property Value
ruleType

Type of the rule.

The ruleType is set using a value from the BusinessRuleModule.enums.RuleType list.

The FILTRATION type is used here.

autocomplete Inverse filtration checkbox. They checkbox may have the true or false values.
baseAttributePatch

Meta-path to the lookup schema column, which will be used for filtration.

The feedback principle is used for building the path to a column (as in EntitySchemaQuery). The path is formed in relation to the schema referenced in the model column.

comparisonType

Type of a comparison operation.

It is set using a value from the Terrasoft.ComparisonType list.

type

Type of the value to be compared with baseAttributePatch.

It is set using a value from the BusinessRuleModule.enums.ValueType list.

attribute

Name of the view model column.

This property is described if the ATTRIBUTE value type (type) is specified.

attributePath

Meta-path to an object schema column.

The feedback principle is used for building the path to a column (as in EntitySchemaQuery). The path is formed in relation to the schema referenced in the model column.

value

Value to be filtered.

This property is described if any value type (type), except ATTRIBUTE is specified.

Examples of adding rules to the edit page

© bpm'online 2002-2017.

Did you find this information useful?

How can we improve it?