Smart Business Rules agent

The Smart Business Rules action lets you automatically generate content in one field based on information stored in other fields.

This is useful when you want Sales Layer to calculate or complete values automatically using simple logic rules, similar to the formulas already available in connectors.

In the initial phase of release, the feature is available only for Products. Support for more operations and additional tables such as VariantsCategories, and others is planned for future updates.

 

Current available functions – first iteration

 

In this first iteration, the Smart Business Rules action supports these four operations only:

Category

Operator / Function

Description

Example

Arithmetic    

+

Addition                                     

Price + Shipping                

Arithmetic    

-

Subtraction                                  

Price - Discount                

Arithmetic    

*

Multiplication                               

Price * 1.21                    

Arithmetic    

/                         

Division                                     

Price / 100                     

 

These operations allow you to create basic numeric rules for product data.

 

Functions that will be available in future iterations

 
 

Category

Operator / Function

Description

Example

Grouping      

( )                       

Parentheses to control precedence            

(Price + Shipping) * 1.21       

Operands      

Numeric literal           

Integer or decimal number                    

100, 1.21                       

Operands      

Product field             

Field reference ([a-zA-Z_][a-zA-Z0-9_]*)     

Price, VAT, Stock_2             

Operands      

String literal            

Text enclosed in single quotes               

'expensive', 'active'           

Comparison    

=                         

Equal                                        

Price = 100                     

Comparison    

<>                        

Not equal                                    

Status <> 'X'                   

Comparison    

 

Greater than                                 

Price > 100                     

Comparison    

=                        

Greater than or equal                        

Price >= 100                    

Comparison    

<                         

Less than                                    

Stock < 10                      

Comparison    

<=                        

Less than or equal                           

Stock <= 10                     

Conditional   

if(cond, yes, no)         

Ternary conditional                          

if(Price > 100, 'expensive', 'cheap')

String        

Left(field, n)            

First N characters                           

Left(description, 10)           

String        

Right(field, n)           

Last N characters                            

Right(sku, 3)                   

String        

Mid(field, start, len)    

Substring from position                      

Mid(name, 2, 5)                 

String        

Len(field)                

Length of the string                         

Len(description)                

String        

Upper(field)              

Converts to uppercase                        

Upper(name)                     

String        

Lower(field)              

Converts to lowercase                        

Lower(name)                     

String        

Trim(field)               

Removes leading and trailing spaces          

Trim(name)                      

String        

Concat(a, b, ...)         

Concatenates values                          

Concat(brand, ' - ', name)      

String        

Contains(field, 'val')    

Checks if substring exists                   

Contains(name, 'pro')           

Navigation    

entity.property           

Property of a related entity                 

Category.Discount               

Aggregation   

Sum(col.field)            

Sum of a collection                          

Sum(Variants.Price)             

Aggregation   

Avg(col.field)            

Average of a collection                      

Avg(Variants.Stock)             

Aggregation   

Count(col)                

Count of a collection                        

Count(Variants)                 

Aggregation   

Min(col.field)            

Minimum of a collection                      

Min(Variants.Price)             

Aggregation   

Max(col.field)            

Maximum of a collection                      

Max(Variants.Price)             

Math          

Round(expr, dec)          

Rounding                                     

Round(Price * VAT, 2)           

Math          

Abs(expr)                 

Absolute value                               

Abs(Price - Cost)               

Math          

Floor(expr)               

Round down                                   

Floor(Price / 10)               

Math          

Ceiling(expr)             

Round up                                     

Ceiling(Stock / PackSize)       

Custom / AI   

ai*(...)                  

AI evaluation (in memory, may include prompts)

ai_score(Name, Category.Name)   

Custom / AI   

custom*(...)              

Arbitrary external logic                     

custom_validation(SKU)          

 

What the Smart Business Rules action does

 

When you add this action to an agent, the agent will calculate a value and write the result into a destination field.

You can configure it to:

  • fill only empty fields
  • overwrite existing values
  • calculate results using a formula built from fields and operations

This helps reduce manual editing and keeps repetitive calculations consistent across your product catalog.

 

Where to find it

 

To add this action:

  1. Open your agent configuration.
  2. Go to the Action step.
  3. Click Add action.
  4. Select Smart Business Rules.
 

 

Once selected, a configuration window will open so you can define how the action should work.

 

How to configure the Smart Business Rules action

 

When the configuration modal opens, you will need to define the following:

 

1. Destination field

 

Choose the field where the calculated result will be saved.

This is the field the agent will update after applying the rule.

 

2. Generation behavior

 

Choose how the agent should write the result:

  • Fill empty fields only: the action only writes a value if the destination field is empty.
  • Overwrite existing content: the action always writes the result, even if the field already contains a value.

This gives you flexibility depending on whether you want to preserve existing data or recalculate values every time the agent runs.

 

3. Formula editor

 

Use the Formula editor to create the rule.

In this area, you can build the calculation by combining:

  • existing fields supported operationsThe result of that formula will be written into the destination field you selected earlier.
 

 

Finish adding the action

 

Once the action is configured:

  1. Click Add action to save it.
  2. Click Next to continue creating your agent.

Your Smart Business Rules action will then be included as part of the agent workflow.

 

 

Common Use Cases

 

The Smart Business Rules action can be useful when you need to:

  • calculate a final price from existing numeric fields
  • generate values based on product dimensions or quantities
  • complete numeric fields automatically without editing each product manually
  • standardize repetitive calculations across many products
 
 

Best practices

 

Before using this action on a large number of products, make sure the source fields used in the formula already contain consistent numeric values. It is also a good idea to test the rule first with a small group of products so you can confirm the result is being written to the correct destination field