Manage your rules on record

Summary

Overview

Reference Entity Rules let you automate attribute enrichment on Reference Entity Records. Define conditions to target specific records and actions to apply automatically whenever a record is saved, keeping your reference data consistent and up to date without manual intervention.

Reference Entity Rules are available for all Akeneo PIM packages and are currently in Beta.

 

 

Access

To access Reference Entity Rules, navigate to Settings > Rules and select the Reference Entity Rules tab.

The rules list displays the following information for each rule:

  • Label: the rule's display name. If no label is defined, the rule code appears in brackets.
  • Status: Enabled or Disabled. Only enabled rules run automatically.
  • Priority: execution order when multiple rules apply to the same record. Higher values run first.
  • Reference entity identifier: the Reference Entity the rule targets.
  • Execution type: always Triggered for Reference Entity Rules (see Execution).
  • Actions: the action types configured on the rule (Copy and/or Template).

Create a rule

In the PIM UI

To create or edit rules, you need the appropriate permissions. Go to System/Roles, select a role, click Permissions/Rules, and enable Create rules and/or Edit rules.

 

To create a rule in the UI, navigate to Settings/Rules and click Create. A pop-up will appear.

 

Each Reference Entity Rule is defined by the following properties, set when the rule is created.

Property Description
Code Unique identifier for the rule. Cannot be changed after creation. Maximum 100 characters.
Label Display name shown in the rules list. Optional. Maximum 255 characters per locale.
Target Always Reference Entity Record. Cannot be changed after creation.
Reference Entity The Reference Entity the rule applies to (e.g., Brand, Manufacturer). One rule targets one Reference Entity.

 

The Target and Reference Entity fields cannot be changed after the rule is saved.

 

By Import

To create rules using a YML file, first create it, then import it into the PIM using the Rule import in YML import job.

For more details on executing an import, refer to Import your data.

 

You can also export rules using the Rule export in YML export job. For more details, see Export your data.

 

Each rule must have a unique code. It can also have a label per enabled PIM locale. This label will appear under Settings/Rules and be visible in your product form under your smart attributes. You can add the labels' settings anywhere in your rule. In the example below, it is placed at the end of the rule, and it adds labels for your American English and French locales. Here is the expected format:

rule_number_2:
        type: record
        priority: 0
        enabled: true
        conditions:
            -
                operator: AND
                value:
                    -
                        field: color
                        value:
                            value: null
                            reference_entity_attribute: label
                            reference_entity_attribute_scope: null
                            reference_entity_attribute_locale: en_US
                            reference_entity_attribute_operator: 'NOT EMPTY'
                        operator: WHERE
                    -
                        field: code
                        value: '123'
                        operator: CONTAINS
        actions:
            -
                template: "{{record.label(null,'en_US')}} is the {{record.biography}} {{record.country}} \nThe 	    favorite colour of the city is {{ record.color | recordLabel('en_US') }}.\n{{ record.code }}"
                to:
                    field: description
                type: template
        labels:
            en_GB: 'Rule number 2'
            en_US: 'Rule number 2'
            fr_FR: 'Rule number 2'
        triggers: {  }
        execution_type: triggered
        reference_entity_identifier: city

If you do not want to add labels to your rule, leave the labels settings with { }.

labels: {}

The rule code will appear between brackets [ ] in the interface if no label is set.

 

 

Record selection

The Record Selection section defines which records the rule applies to. At least one condition is recommended to avoid targeting all records in the Reference Entity.

When building your rules, you can use condition operators to define how multiple conditions should interact. By default, conditions are combined with AND, meaning all of them must be met. With the OR operator, you can create more flexible rules by allowing records to match if at least one of the conditions is true. This makes it easier to cover broader scenarios without multiplying the number of rules.

Conditions can target the following fields on a record:

Field type Examples Available operators
Date System properties Created date, Updated date =, !=, <, >, <=, >=, EMPTY, NOT EMPTY, BETWEEN, NOT BETWEEN
other System properties  Code =, !=, EMPTY, NOT EMPTY, CONTAINS, DOES NOT CONTAIN, STARTS WITH, ENDS WITH, IN, NOT IN.
Text attributes Name, Description, Label =, !=, EMPTY, NOT EMPTY, CONTAINS, DOES NOT CONTAIN, STARTS WITH, ENDS WITH
Number attributes Population, Rating =, !=, <, >, <=, >=, EMPTY, NOT EMPTY, BETWEEN, NOT BETWEEN
Option / Option collection Status, Type IN, NOT IN, EMPTY, NOT EMPTY
Record / Record collection Linked Reference Entity attributes IN, NOT IN, EMPTY, NOT EMPTY, WHERE
Asset Collection Media IN, NOT IN, EMPTY, NOT EMPTY

 

The WHERE operator is available on Record and Record collection attributes. It lets you filter records based on an attribute value of the linked Reference Entity (e.g., target records where a linked Brand's country equals "France").

 

 

Actions

The Then section defines what the rule does when conditions are met. A rule can include multiple actions. Use Add Action to combine Copy and Generate Dynamic Content actions in the same rule.

Two action types are available for Reference Entity Rules.

 

Copy Attribute Value

The Copy Attribute Value action copies the value of a source attribute into a target attribute on the same record. Source and target must be compatible attribute types.

Configure the following fields for this action:

  • Source attribute: the attribute whose value is read.
  • Source channel: required if the source attribute is scopable.
  • Source locale: required if the source attribute is localizable.
  • Target attribute: the attribute where the value is written.
  • Target scopable: required if the target attribute is scopable.
  • Target locale: required if the target attribute is localizable.

 

 

Generate Dynamic Content

The Generate Dynamic Content action generates a text value using a Twig template. The template can reference record attribute values, system properties, and apply formatting functions to produce dynamic output.

Configure the following fields for this action:

  • Template: a Twig expression using {{ record.attribute_code }} syntax to reference record data. Maximum 32,000 characters.
  • Target attribute: the Text attribute where the rendered result is written. Only Text attributes are supported as targets for record rules.
  • Target locale: required if the target attribute is localizable.
  • Target channel: required if the target attribute is scopable.

 

The following record data is accessible in the template:

Attribute type Capabilities (not exhaustive) Variable Example of output
UUID Display the record UUID  {{ record.uuid }} 2a443ff2-f9f6-4cfc-bba8-eb15b10ef8cc
Code Display the record code  {{ record.code }} record_code
Text Attribute Display the full text {{ record.Attributecode }} My text
  Display the text of a specific locale (localizable attribute) {{ record.Attributecode(null, 'fr_FR') }} Mon Texte
  Display the text of a specific channel and locale (localizable & scopable attribute) {{ record.Attributecode('ecommerce', 'fr_FR') }} Mon autre texte
Number Attribute Display the number {{ record.Attributecode }} 1
  Display the rounded number using round filter {{ record.AttributeCode | round }} 1234.1400
  Display the rounded number with 2 decimals using round filter {{ record.AttributeCode | round(2) }} 1234.14
  Display the number with 2 decimals, a space for thousands and a dot for decimals using number_format filter {{ record.Attributecode | number_format(2, '.', ' ') }} 1 234.14
Simple Select Attribute Display the code of the attribute option {{ record.Attributecode | optionCode }} optioncode
  Display the label of the option in the locale of destination {{ record.Attributecode | optionLabel(target.locale) }} Option Label
  Display the label of the option in a specific locale {{ record.Attributecode | optionLabel('fr_FR') }} Label de l’option
  Apply a default value when the label is empty using the default filter {{ record.Attributecode | optionLabel('en_US') | default('default label') }} default label
Multi Select Attribute List all option codes, separated by a comma {{ record.Attributecode | optionCode }} optioncode1,optioncode2
  List all option codes, separated by a comma {{ record.Attributecode | optionCode }} optioncode1,optioncode2
  List all option labels in a specific locale, separated by a comma {{ record.Attributecode(null, 'en_US') | optionLabel('en_US') }} option label 1,option label 2
Reference entity single link Attribute Display the code of the reference entity record {{ record.Attributecode }} record_code
  Display the label of the reference entity record in the locale of destination {{ record.Attributecode | recordLabel(target.locale) }} Record Label
  Display the label of the reference entity record in a specific locale {{ record.Attributecode | recordLabel('en_US') }} Record Label
  Apply a default value when the label is empty using the default filter {{ record.Attributecode | recordLabel('en_US') | default('default label') }} default label
Reference entity multiple link Attribute Display the codes of the reference entity records, separated by a comma {{ record.Attributecode }} record_code1, record_code2, record_code3
  Display the labels of the reference entity records in the locale of destination, separated by a comma {{ record.Attributecode | recordLabel(target.locale) }} Record Label 1, Record Label 2, Record Label 3
  Display the labels of the reference entity records in a specific locale, separated by a comma {{ record.Attributecode | recordLabel('en_US') }} Record Label 1, Record Label 2, Record Label 3

Use the Preview Record button to test the template output on a specific record before saving the rule.

 

 

Execution

Reference Entity Rules use the Triggered execution type exclusively. A rule runs automatically each time a record belonging to the targeted Reference Entity is saved, provided the record matches the rule's conditions. When multiple rules target the same Reference Entity, they are executed in descending Priority order.

Actions are applied asynchronously. The result may appear with a short delay after the record is saved, depending on the processing queue at the time of execution. 

Only Enabled rules are executed automatically. Disabled rules are saved but never triggered.