---
title: "Use Rule Builder"
app: "Product Configurator"
section: "How-to guides"
last_updated: "2022-05-19"
url: "https://insight-works.com/kb/product-configurator/use-rule-builder/"
---

# Use Rule Builder

Product Configurator’s Rule Builder allows you to design and execute rules such as setting values, displaying messages, and hiding/showing options or choices based on specified conditions. Each rule consists of a rule definition with definition lines and action lines. The rule definition is linked to the configuration option.

When the _Configurator BOM Designer_page loads an item category or existing item, the related rules execute for all configuration options. When a configuration option changes, the related rule executes for the specific configuration option.

Complete the following to create, edit, or delete the rule definition in the Product Configurator:

1. Navigate to the _Configurator Item Categories_ page in Business Central.
2. Select the item category.
3. Select **Configurator Options**.
4. Complete one of the following in the _Rule Action_ field:

   1. Create: Select **Create…** and select **Yes** when prompted.
   2. Edit: Select **Edit…**, select **Edit**, select **OK**, and make changes as needed.
   3. Delete: Select **Edit…**, select **Delete**, select **OK**, and select **Yes**.

 Note: The _Rule Action_ field shows as **Create…** when no rule exists and **Edit…** when there is an existing rule. Creating or editing the rule opens the _Rule Definition Builder_ page.

The _Rule Definition Builder_ page contains the definition lines (evaluation conditions) and the related action lines to execute when the condition evaluates to true or false.

The definition line can be a group or variable. The first definition line in each rule definition must contain a group, this is called the main group. Each group must contain at least one variable or nested group and each variable must be inside a group.

![](/wp-content/uploads/kb-legacy/prod-config-use-rule-builder1.png)

### Definition Line Group

The definition line group can be one of the following types:

| **Group Type** | **Description** |
| --- | --- |
| Execute All (Ignore Results) | The rule evaluates all variable and nested group conditions and executes the “when condition is true” actions for the group regardless of the group condition result. The “when condition is false” actions for the group are ignored for this type. |
| Execute Until True (Match Any) | The rule evaluates all variables and nested groups as sufficient conditions requiring only one of their results to be true to execute the “when condition is true” actions for the group. If none of their results are true, the rule executes the “when condition is false” actions for the group. If it finds a true result, the rule stops evaluating the remaining variables and nested groups and does not execute their actions. |
| Execute While False (Match None) | The rule evaluates the variables and nested groups as necessary conditions requiring all their results to be false to execute the “when condition is true” actions for the group. If any of their results are true, the rule executes the “when condition is false” actions for the group. If it finds a true result, the rule stops evaluating the remaining variables and nested groups and does not execute their actions. |
| Execute While True (Match All) | The rule evaluates all variables and nested groups as necessary conditions requiring all their results to be true to execute the “when condition is true” actions for the group. If any of their results are false, the rule executes the “when condition is false” actions for the group. If it finds a false result, the rule stops evaluating the remaining variables and nested groups and does not execute their actions. |

### Definition Line Variables

Definition line variables can evaluate to either text or numeric values. Specifically for the Product Configurator, the variables consist of the choice code (text) and quantity per (numeric) for the configuration options. For example, if the configuration includes two options with the names LENGTH and WIDTH there are variables for LENGTH.CHOICE, LENGTH.QTY, WIDTH.CHOICE, and WIDTH.QTY. Both LENGTH.CHOICE and WIDTH.CHOICE evaluate to text values; both LENGTH.QTY and WIDTH.QTY evaluate to numeric values.

The variable line creates the condition to evaluate. It includes a “value on the left”, a “value on the right”, and a comparison operator in between. The condition result is either true or false.

| **Value on the left** | **Comparison operator** | **Value on the right** | **Condition result** |
| --- | --- | --- | --- |
| 5 | is equal to | 5 | true |
| 5 | is equal to | 10 | false |
| 5 | does not equal | 10 | true |

Definition line variables can also be set to [USER PROMPT], which opens a confirmation message for the user to select **Yes** or **No**. Selecting **Yes** evaluates the condition to true; selecting **No** evaluates the condition to false.

When creating a new rule definition, the first definition line defaults to a group, called the main group, and the second definition line defaults to a variable. Complete the following to set the group or variable in the _Rule Definition Builder_ page:

1. Add the main group and initial variable lines:

   1. Set the _Variable / Group Name_ to the required group type for the main group line.
   2. Set the _Variable / Group Name_ to the required configuration option variable for the variable line **or** delete the line if a nested group is required.
2. Select the existing group and choose the Insert Group Below action from the ribbon.
3. Set the _Variable / Group Name_ to the required group type.
4. Select the existing group or previous variable and choose **Insert Condition Below** (adds a definition line for the variable).
5. Set the _Variable / Group Name_ to the configuration option variable (acts as the “value on the left” in the condition).
6. Set the _Line Condition_ to the comparison, or relational, operator to use to evaluate the condition.
7. Set the _Comparison Value_ to the value to compare against the configuration option variable (acts as the “value on the right” in the condition).

### Line Condition

When the _Variable / Group Name_ is [USER PROMPT], the _Line Condition_ must be blank and the _Comparison Value_ set to the text displayed in the confirmation message.

The _Line Condition_ can be one of the following:

| **Line Condition** | **Description** |
| --- | --- |
| is equal to | Returns true if the variable value is equal to the comparison value; otherwise, false. For text variables, the comparison value is case sensitive and requires an exact match with this line condition (e.g., ‘RULE’ is equal to ‘rule’ is false, but ‘RULE’ is equal to ‘RULE’ is true). |
| does not equal | Returns true if the variable value is not equal to the comparison value; otherwise, false. For text variables, the comparison value is case sensitive and requires an exact match with this line condition (e.g., ‘RULE’ does not equal ‘rule’ is true, but ‘RULE’ does equal not ‘RULE’ is false). |
| is less than | Returns true if the variable value is less than the comparison value; otherwise, false. For text variables, the comparison value is case sensitive with this line condition (e.g., ‘RULE’ is less than ‘rule’ is false, but ‘rule’ is less than ‘RULE’ is true). |
| is greater than | Returns true if the variable value is greater than the comparison value; otherwise, false. For text variables, the comparison value is case sensitive with this line condition (e.g., ‘RULE’ is greater than ‘rule’ is true, but ‘rule’ is greater than ‘RULE’ is false). |
| is less than or equal to | Returns true if the variable value is less than or equal to the comparison value; otherwise, false. For text variables, the comparison value is case sensitive with this line condition. |
| is greater than or equal to | Returns true if the variable value is greater than or equal to the comparison value; otherwise, false. For text variables, the comparison value is case sensitive with this line condition. |
| contains | Returns true if the text variable value contains the comparison value; otherwise, false. For text variables, the comparison value is case sensitive with this line condition. For numeric variables, this line condition does not apply. |
| is not blank | Returns true if the text variable value is not blank or the numeric variable value is not zero; otherwise, false. |
| is blank | Returns true if the text variable value is blank or the numeric variable value is zero; otherwise, false. |
| is in filter | Returns true if the variable value matches the Business Central filter criteria specified by the comparison value; otherwise, false. |
| is not in filter | Returns true if the variable value does not match the Business Central filter criteria specified by the comparison value; otherwise, false. |

### Action Lines

Action lines are set for when the condition result is true or false. Action lines reference the definition line and can be set on the group or variable. When actions are set on the group, the condition result is based on the condition results for all variables and nested groups inside it. When actions are set on the variable, the condition result is based only on the variable. In both cases, the actions for the definition line execute based on its condition result.

If actions are specified for a group definition line, they execute based on the group condition result. See the _Group Type_ table from above for information on when group condition results evaluate to true or false.

If actions are specified for a variable definition line, they execute based on the variable condition result.

Note: Depending on the group type and ordering of the definition lines in the group, the variable or nested group condition may not be evaluated and their actions ignored regardless of their expected condition result.

Complete the following to set the action lines in the _Rule Definition Builder_ page:

1. Select the definition line where the actions apply and will execute based on its condition result.
2. Add the actions to execute when the condition result for the definition line is true in the _When Condition is True_ section.
3. Add the actions to execute when the condition result for the definition line is false in the _When Condition is False_section.
4. Initiate the action line for the condition result.
5. Set the _Rule Action_ to the action type to execute (see the table below for available actions).
6. Set the _Execution Order_ for the action to execute relative to the other actions for the condition result.
7. Set the _Variable Name_ to the configuration option choice or quantity affected by the action (if applicable).
8. Set the _Value_ to the parameter required by the action line (if applicable; see the table below on how _Value_is handled).
9. Set the _Target Rule ID_ to another rule to execute (if applicable).

 Note: The _Target Rule ID_ must not match its rule definition.

The _Rule Action_ can be one of the following:

| **Action Type** | **Description** |
| --- | --- |
| Continue Processing | Action ignores the condition result, and no action is executed. |
| Error | Action displays an error message with text specified by the rule action value. |
| Hide Choice | Action hides the option choice as specified by the rule action variable name and value in the BOM Designer choice code lookup. |
| Hide Option | Action hides the option as specified by the rule action variable name and value in the BOM Designer. |
| Message | Action displays a message with text specified by the rule action value. |
| Run Rule | Action executes another rule as specified by the rule action target rule ID. |
| Set Value | Action sets the value for the rule action variable name with the specified value. |
| Show Choice | Action shows the option choice as specified by the rule action variable name and value in the BOM Designer choice code lookup. |
| Show Option | Action shows the option as specified by the rule action variable name and value in the BOM Designer. |

Note: For quicker entry of similar actions for the same definition line, use the **Copy to False** or **Copy Inverse to False** actions found in the _When Condition is True_ section and the **Copy to True** and **Copy Inverse to True** actions found in the _When Condition is False_ section to copy the selected action line(s) from one condition result to the other.

For example, if the rule requires actions to set the value when the condition is true and reset the value when the condition is false, enter the action line to set the value in the _When Condition is True_ section and click **Copy Inverse to False** to create the action line to reset the value in the _When Condition is False_ section.
