What is a rule?

Summary

Definition of a rule

Akeneo’s rules engine is a powerful feature included in Akeneo Enterprise Edition. A rule is a set of actions and conditions that allows you to automatize data enrichment.

For instance, rules allow you to automatically:

  • fill in attributes
  • categorize new products
  • set a default value to an empty attribute
  • assign values to new products
  • copy an attribute value to another attribute

Rules can only be imported in Akeneo using a YML file, and they can be managed from the UI. Check the How to manage your rules article to learn more about our rules.

Rules are meant to save you time enriching your product information.

Rules can be prioritised from 0 to 100, a rule with a priority of 100 will be applied before a rule having a priority of 10 or 50.

Example of a rule

You need one or several conditions to trigger an action. For instance, to set the Canon brand to all Canon camcorders that do not have a brand yet, you'll have to create a rule like the one below:

IF:

  • my product is in the Camcorders family
  • my product attribute name contains the word: Canon
  • my brand attribute is empty

THEN: set the Canon value in my product brand attribute

Here is the example of the YML format expected for this rule.

rules:
            camera_set_canon_brand:
                priority: 0
                conditions:
                    -   field: family
                        operator: IN
                        value:
                            - camcorders
                    -   field: name
                        operator: CONTAINS
                        value: Canon
                    -   field: camera_brand
                        operator: 'NOT IN'
                        value:
                            - canon_brand
                actions:
                    -   type: set
                        field: camera_brand
                        value: canon_brand

Find more information about all the conditions/actions and create your own rules! To do so, refer to our technical documentation: General information about rule format.