logo
logo

Trigger conditions

Trigger conditions determine if the trigger actions execute after a specific event occurs.

Structure

Conditions are organized by entity definition. For each entity definition, you can combine conditions using logical operators (AND and OR).

Trigger conditions have the following parameters:

  • Entity definitions: indicate which entities to observe when the specified event occurs. You can select multiple entity definitions with different conditions for each.

  • Logical operators: indicate how to combine conditions. With the AND operator, all linked conditions must be met. With the OR operator, one of the linked conditions must be met. You can combine logical operators to achieve more complex logical operators.

    Important

    Logical operators combine conditions at the same grouping level. You can use sub-groups to create more complex combinations.

  • Conditional statements: these are the building blocks of the trigger conditions. Each statement is made up of a property (depending on the selected entity definition) and a conditional clause (depending on the selected property).

The following image provides an example of a set of conditions defined for a trigger where the entity definition is M.Asset and where the conditional statements are grouped.

You can use one of the following global operators between entity definitions:

  • All: matches all of the conditions.
  • Any: matches any of the conditions.

Configuration

To configure trigger conditions:

  1. On the menu bar, click Manage .

  2. On the Manage page, click Triggers.

  3. On the Triggers page, next to the trigger name, click View details .

  4. On the trigger detail page, click the Conditions tab, and then click Add definition and select a definition.

    If you want the trigger to observe all the entities when the specified event occurs, use the Any definition option.

  5. Click + Condition and, from the condition drop-down lists, create a conditional statement.

  6. To add multiple conditions to the entity definition, click + Condition again to add another condition.

  7. Click Save.

    Note

    Which options are available in the property value options list depends on the selected property. Similarly, which options are available in the operation options list depends on the selected property and the selected property value.

    Tip

    For certain properties and operations (for example, the contains operation), you can specify in the condition operation that case is important by selecting Match case.

Create a conditions sub-group

To create a conditions sub-group:

  1. On the Conditions tab, create a conditional statement.

  2. Inside the condition statement container, click Make group to create a new sub-group.

    Note

    Each sub-group has its own logical operator. Sub-groups can contain other sub-groups.

Advanced mode

To use the advanced mode:

  1. On the Conditions tab, click Advanced mode.

  2. In advanced mode, view, create, edit and delete conditions.

  3. To switch the view back to the regular editing mode, click Basic mode.

Event listening

In Sitecore Content Hub™, if you modify a relation between two entities, the change event is only produced on the changed entity's side. In other words, if a trigger condition is set to observe an entity's relation, the trigger only executes if the relation is updated from the referenced entity's side. This is important when configuring a trigger condition.

For example, to configure a trigger that executes each time an asset is removed from a collection, you set the trigger condition to observe the M.Asset entity definition, specifically the CollectionToAsset relation. In this case, if the asset is removed (from the collection) from the asset's side, the trigger executes; however, if the asset is removed from the collection's side, the trigger does not execute.

For a trigger to execute when an asset is removed from a collection regardless of the source of change, the trigger condition must include both the M.Asset entity definition and the M.Collection entity definition, each specifying the CollectionToAsset relation.

Note

For a trigger to execute when a relation is updated, the trigger condition must observe both entity sides of that relation.

Can we improve this article ? Provide feedback