Skip to main content
Version: 1.9.0

Autocomplete Rules

Depending on your needs and business processes, you can create rules for autocompletion of Reference type fields in records of tables belonging to any application. The system allows you to make a selection of possible values for autocompletion as well as set its logic:

  • The Custom autocomplete type allows you to create a script for the value selection among records included in the secondary selection. Alternatively, you can specify a single record to be used as the autocomplete value.
  • The Load balancer autocomplete type makes the system choose one record from those included in the secondary selection that is least frequently used as a value in the autocomplete table records.
  • If you use the Round robin autocomplete type, the records included in the secondary selection will be used as values in turns, one after another.
tip

Roles required:

  • Create, edit, delete – crm_admin, admin.
  • Read – any user of the agent interface.

Create an autocomplete rule


caution

Autocompletion occurs only when a new record is being created. No other events trigger the autocompletion of fields in a record according to a given rule.

To create an autocomplete rule, follow the steps below:

  1. Navigate to CRM → Settings → Autocomplete Rules.

  2. Click New and fill in the form fields.

  3. Click Save or Save and exit to apply the changes. A record containing and enabling the autocomplete logic will automatically be added to the Business Rule (sys_business_rule) table.

    The values of the created business rule's fields
    1. The Name of the created business rule is generated according to the following template: {Autocomplete rule Name} Autocomplete Business Rule.

    2. Some of the business rule's fields are completed with the values from the autocomplete rule. The table below shows the correlation of such fields in the autocomplete and business rule records.

      Autocomplete rule fieldBusiness rule field
      DescriptionDescription
      InheritedInherited
      ActiveActive
      Table to autocompleteTable
      Autocomplete conditionsFilter conditions
    3. Some of the business rule's fields are automatically completed with predefined values, the same for all such rules:

      FieldValue
      WhenBefore
      Order999
      Record createdYes
      AdvancedYes

Autocomplete Rule form fields

FieldMandatoryDescription
NameYSpecify the name of the autocomplete rule.
DescriptionNAdd a description of the autocomplete rule.
ActiveNSelect the checkbox to activate the autocomplete rule. When the rule is active, the autocomplete is performed according to its configuration. If you deactivate the autocomplete rule, the created business rule is deactivated as well.
InheritedNSelect the checkbox to apply the automatically created Business rule to the child tables of the specified Table to autocomplete.
Use script for autocomplete valueNThe field is displayed if the Autocomplete type is set to Custom. Select the checkbox to create the value selection logic with a script for the records included in the secondary selection.
Use script to narrow selectionNThe field is displayed if the Autocomplete type is set to Custom and the Use script for autocomplete value checkbox is selected. Select the checkbox to create a script narrowing the pool of possible autocomplete values after the secondary selection's condition is applied.
Business ruleN

The field is completed automatically after saving the record and refers to the automatically created business rule that implements the autocomplete logic.

You can manage this business rule in System Settings → Business Rules.

Initial selection tableYSpecify a table with a field referencing the possible autocomplete values' table.

If you change the value of the current field, the Secondary selection field field will be cleared.

Initial selection conditionsNUse the condition builder to create a condition for the Initial selection table records. For instance, if User Group is set as the Initial selection table, in the current field you can specify the group whose members can be used as autocomplete values.

If you change the value of the current field, the Autocomplete value field will be cleared.

Secondary selection fieldYSpecify a Reference type field of the Initial selection table or its parent table. This field must refer the table of possible autocomplete values. For instance, if User Group is set as the Initial selection table, in the current field you can specify the User column to use employee profiles included in the selected group as possible autocomplete values.

If you change the value of the current field, the Autocomplete value and Field to autocomplete fields will be cleared.

Secondary selection conditionsNUse the condition builder to narrow the secondary selection of possible values. For instance, if User Group is specified in the Initial selection table field, and the Secondary selection field is User, the current field may contain additional criteria for the users of the group selected according to the initial selection condition. Such criteria may include, for instance, being active or belonging to a specific company.

If you change the value of the current field, the Autocomplete value field will be cleared.

Table to autocompleteYSpecify the table whose records must be autocompleted with the value selected after applying the initial and secondary selections, conditions configured for them, and the execution of scripts if configured.
Field to autocompleteYThe field is displayed after you specify the Table to autocomplete. Specify a Reference type field belonging to the Table to autocomplete whose value you need to autocomplete.

If you change the value of the current field, the Autocomplete value will be cleared.

Autocomplete conditionsNThe field is displayed after you specify the Table to autocomplete. Use the condition builder to create a condition to be applied to the records of the Table to autocomplete. This condition must be met for the autocomplete rule to apply to a record. For instance, you can allow autocompletion only for records created in specific states.
Autocomplete typeY

Select the autocomplete type. Available options:

  • Custom – this mode allows for nonrigid autocomplete logic that you can configure using scripts. If the Use script for autocomplete value checkbox is selected, you will be able to specify the logic for selecting an autocomplete value among the records included in secondary selection in the Autocomplete value script field. You can also select the Use script to narrow selection checkbox to narrow the list of possible values with the script that you specify in the Narrow selection script field. If the Use script for autocomplete value checkbox is cleared, you will be able to specify a single autocomplete value in the Autocomplete value field. Default value.
  • Load balancer – this mode automatically finds and uses the least "loaded" value among the records included in the secondary selection. The system calculates the number of records in the Table to autocomplete with each value included in the selection, excluding the records of the table to autocomplete in the Ignored states. After that, the least frequently used value is selected as the value for the Field to autocomplete. If several values with identical frequency of use exist, the system selects the one created later than the others.
  • Round robin – this mode uses the values that are included in the secondary selection in turns, one after another. Each time this logic is executed, the Current counter position is increased by 1 until it uses all possible values included in the selection. After that, the counter is reset, and the rotation starts again.
Narrow selection scriptY/NThe field is mandatory and displayed if the Use script to narrow selection checkbox is selected. Create a script that will narrow the list of possible values for autocompletion after the initial and secondary selection conditions are applied.
Autocomplete value scriptY/NThe field is mandatory and displayed if the Use script for autocomplete value checkbox is selected. Create a script that will select the record that must be used as the Autocomplete value among the records included in the secondary selection and that met the criteria of the Narrow selection script if the latter is configured.
State fieldY/NThe field is mandatory and displayed if the Autocomplete type is set to Load balancer. Select a Choice type column from the specified Table to autocomplete or its parent table that contains the record's state.

If you change the value of the current field, the Ignored states field will be cleared.

Ignored statesNThe field is displayed if the Autocomplete type is set to Load balancer. Select the states in which records of the table to autocomplete need to be ignored when calculating a value's load.
Current counter positionYThe field is mandatory and displayed if the Autocomplete type is set to Round robin. Specify the current position of the autocomplete counter. A record's position depends on the creation dates of the records included in the selection: the most recently created record takes position 0. Each previously created record has a position higher by 1. At the initial launch of the autocomplete rule, the calculation starts with position 1, which corresponds to the second to latest created record. If you create a new record that will be included in the selection, the positions of the previous records will shift by 1, and some might be used as the value again. Such situation may also occur if an older record is modified and gets included in the selection: it will be added to the possible values pool depending on its creation date, shifting the positions of the earlier created records by 1.
Autocomplete valueY/NThe field is mandatory and displayed if all of the following conditions are met:
  • the Autocomplete type is set to Custom,
  • the Use script for autocomplete value checkbox is cleared,
  • the Secondary selection field and Field to autocomplete fields are completed.
From the records included in the secondary selection, specify a value to be used in the Field to autocomplete.

Each time an autocomplete rule is triggered, you will see an informational toast message about it on the autocompleted record's form.

caution
  1. There can be only one autocomplete rule configured for each column of a specific table. If you create a new rule for the same column, the older rule automatically deactivates.

  2. If applying configured selection results in zero possible values, the autocomplete will not happen. You will see a corresponding message on the form of the record that was supposed to be autocompleted.

  3. Changing the values in the following fields of an autocomplete rule updates the created business rule:

    • Name
    • Description
    • Table to autocomplete
    • Field to autocomplete
    • Autocomplete conditions
    • Active
    • Inherited

    Changing values in the other fields of an autocomplete rule will not update the related business rule.

  4. The system uses the logic validating an employee's presence if all of the following conditions are met:

    • the autocomplete value is taken from the User (user) table or its child table,
    • the absence engine is configured for the table of possible values,
    • according to the Absence (sys_personal_schedule_entry) table, the selected user is absent today.

    When all the conditions listed above are met, different logic is used depending on the Autocomplete type:

    Autocomplete typeResult
    • Load balancer
    • Round robin
    • Custom without the use of the Autocomplete value script
    The user whose profile is supposed to be the autocomplete value is skipped, and the next one from the pool of possible values is assigned.
    Custom with the use of Autocomplete value scriptThe presence validation occurs after the secondary selection and before the logic from the script is executed. If the script logic assigns a user who is absent today to a record, autocompletion will not occur. You will see a corresponding message on the form of the record that was supposed to be autocompleted.