Rule Builder Lookup Configurations in Product Configurator

Skip to main content

Rule Builder Lookup Configurations in Product Configurator

You are here:

Lookup configurations allow you to retrieve the value of any field in any Business Central table using dynamic, rule-driven parameters. Lookup configurations integrate with the Rule Builder expression evaluator and are particularly useful in the Product Configurator for automatically obtaining option values based on user input. When a lookup configuration is evaluated, all Rule Builder variables embedded in the filter are replaced with their current values, allowing the filter to change dynamically based on what the user has selected. If a result is found, the field value is returned regardless of how the expression’s error mode is set.

Set up Rule Builder Lookup Configurations

  1. Navigate to the Rule Builder Lookup Configurations list page in Business Central.
  2. Select New and complete the following fields in the Rule Builder Lookup Configuration card page:
    • Code: Enter a unique code or identifier for this configuration using letters, numbers, underscores, and hyphens; this code is referenced directly in expressions wherever the lookup is used.
    • Description: Enter a meaningful name to help users recognize this configuration.
    • Table No. / Name: The Business Central table you want to query.
    • Field No. / Name: The specific field from the table whose value you want to return from the matched record.
  3. Set the Find Mode to control how the lookup resolves the result when the filter matches more than one record:
    • First: Returns the value from the first matching record found in the table.
    • Last: Returns the value from the last matching record found in the table.
    • Exact: Returns a value only if exactly one match exists; if zero or more than one record matches the filter, nothing is returned.
  4.  Define the Lookup Table View:
    • Product Configurator variables:
      • [optionCode.CHOICE]: Replaced at evaluation time with the choice code currently set for that option.
      • [optionCode.QTY]: Replaced at evaluation time with the current quantity per unit set for that option.
    • Custom and general Rule Builder variables:
      • [variableName]: Custom variables do not require dot suffix.

Expression Syntax

Once your configuration is saved, reference it in a Rule Builder expression using the following syntax:

LookupValue(lookupCode;errorMode)

Parameter Description
lookupCode The unique code that is assigned to the lookup configuration.
errorMode Either 1 or 0.
1 = throw an error if no result is found.
0 = return blank/zero silently if no result is found.
In both cases, if a result is found the value is returned.

Examples:
LookupValue(ITEM;1): Returns result or throws error if not found.
LookupValue(ITEM;0): Returns result or blank/zero if not found (no error).

Product Configurator applications and use cases

Lookup configurations can be used in the following places in the Product Configurator:

  • The Option Choice’s Quantity Calculation Formula to return a numeric value for use in its calculation.
  • Rule Builder definition line’s Comparison Value and action line’s Set Value action to return either a numeric or text value to use in its evaluation.

Example one

Component item unit volume:
A configuration requires the user to select a component item and based on their selection the configuration needs to find its unit volume. The unit volume is stored on the item record in Business Central.

Set it up

Options:

  • ITEM: Captures the user’s component item selection. Has three choices: 1000, 1100, and 1200, each corresponding to an item whose number matches the choice code. Their unit volumes are 10, 20, and 30 respectively.
  • UNITVOLUME: Holds the unit volume for the selected item. Has a single default choice used when no explicit user selection is needed. Its Quantity Calculation Formula is evaluated to set the quantity per unit value for this option.

Lookup configuration:

  • Code: ITEM_UNITVOLUME
  • Description: Find the item’s unit volume.
  • Table No. / Name: 27 / Item
  • Field No. / Name: 44 / Unit Volume
  • Find Mode: Exact
  • Lookup Table View: WHERE(No.=FILTER([ITEM.CHOICE]))

The Find Mode is set to Exact because each item number is unique; only one record matches, and returning a result for anything other than a single match would indicate unexpected data.

In the Quantity Calculation Formula for the UNITVOLUME option’s default choice, the following expression is entered:
LookupValue(ITEM_UNITVOLUME;0)

The error mode is set to 0 so that if no matching item is found (e.g., before the user has set ITEM), the quantity per unit silently returns zero rather than throwing an error.

How it works

Before the user selects an item, the [ITEM.CHOICE] variable has no value, so the lookup returns zero and the UNITVOLUME option’s quantity per unit is 0.

When the user selects 1000 for the ITEM option, the Quantity Calculation Formula for the UNITVOLUME default choice evaluates. The expression finds the ITEM_UNITVOLUME lookup configuration and applies its lookup table view, which evaluates to WHERE(No.=FILTER(1000)). The Item table is filtered to item 1000, and its Unit Volume of 10 is returned. This value is set as the quantity per unit for the UNITVOLUME option.

Selecting 1100 or 1200 follows the same logic; the lookup table view evaluates to WHERE(No.=FILTER(1100)) or WHERE(No.=FILTER(1200)) and returns 20 or 30 respectively.

Example two

Set option choice based on multiple other option choices:
A configuration requires one option’s choice to be set automatically based on the choices selected for three other options. The relationship between these option choices is stored in the Rule Builder Decision Entry table, which you can use to store company-specific data to support lookup configurations and is accessible via the Rule Builder Decision Entries list page.

Set it up

Options:

  • OPTION01 / OPTION02 / OPTION03: Each includes the same set of choices: A, B, and C.
  • OPTION04: Holds the automatically determined choice representing the combined selections of the other three options; Its choices include every possible combination of A, B, and C across the three options (AAA, AAB, AAC, ABA, …, CCC [27 combinations in total]).

Decision Entries

The Rule Builder Decision Entries are populated with one row per combination, using OPTION04 as the code. The Lookup Code fields capture the individual choices for OPTION01, OPTION02, and OPTION03, and the Text Lookup Result holds the corresponding OPTION04 choice:

Code Description Lookup Code 1 Lookup Code 2 Lookup Code 3 Text Lookup Result
OPTION04 A, A, A A A A AAA
OPTION04 A, A, B A A B AAB
OPTION04 A, A, C A A C AAC
OPTION04 C, C, A C C A CCA
OPTION04 C, C, B C C B CCB
OPTION04 C, C, C C C C CCC

Enter all 27 combinations to ensure every valid selection by the user has a matching record.

Lookup configuration:

  • Code: OPTION04
  • Description: Find the choice code for OPTION04 from OPTION01, OPTION02, and OPTION03
  • Table No. / Name: 70098518 / Rule Builder Decision Entry
  • Field No. / Name: 11 / Text Lookup Result
  • Find Mode: Exact
  • Lookup Table View: WHERE(Lookup 1 Code=FILTER([OPTION01.CHOICE]),Lookup 2 Code=FILTER([OPTION02.CHOICE]),Lookup 3
  • Code=FILTER([OPTION03.CHOICE])) SORTING(“Code”, “Lookup 1 Code”, “Lookup 2 Code”, “Lookup 3 Code”, “Lookup 1 Number”, “Lookup 2 Number”, “Lookup 3 Number”) ORDER(Ascending)

The Find Mode is set to Exact because each combination of three choices maps to exactly one decision entry record; if more than one record matched or no record was found, it would indicate a data setup issue. The Lookup Table View includes explicit sorting and ascending order to ensure consistent evaluation.

Option rules setup

OPTION04 has a rule with a match all group to check conditions where the choices for OPTION01, OPTION02 and OPTION03 are all non-blank. The rule has two outcomes:

  1. When the group is true: A Set Value action sets the OPTION04 choice using the expression LookupValue(OPTION04;1). The error mode is set to 1 so that if no matching decision entry record is found, the user receives an error indicating the configuration could not be updated. This signals a missing entry or row in the decision entry data.
  2. When the group is false: A Set Value action sets the OPTION04 choice to blank. OPTION01, OPTION02, and OPTION03 each have a rule that triggers a Run Rule action to re-evaluate the OPTION04 rule whenever their choice changes. This ensures OPTION04 stays in sync whenever any of the three source options are updated.

How it works

When the user has not selected a choice for OPTION01, OPTION02, or OPTION03, the match all group evaluates to false and OPTION04 is set to blank.

When the user sets OPTION01, OPTION02, and OPTION03 to A, A, and A respectively, the rule group becomes true and the Set Value action triggers. The expression finds the OPTION04 lookup configuration and applies its lookup table view, which evaluates to WHERE(Lookup 1 Code=FILTER(A),Lookup 2 Code=FILTER(A),Lookup 3 Code=FILTER(A)). The Rule Builder Decision Entry table is filtered to the matching entry and its Text Lookup Result of AAA is returned. This value is then set as the choice for OPTION04.

Other combinations follow the same logic:

OPTION01 Choice OPTION02 OPTION03 OPTION04 Result
A A B AAB
A B C ABC
B A A BAA
C C A CCA
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Need help?

Leave A Comment

Table of Contents
Go to Top