Skip to main content

Triggers

The triggers method is where you define the source group and the types the schema should process.

You can add multiple triggers to a schema.

Triggers example
triggers: function(context) {
context.triggers('cms', ['contentPage', 'articlePage']);
context.triggers('pim', ['product']);
}

TriggersContext object

The TriggersContext object is passed into the triggers method and gives you access to a set of methods which is described below.

Methods

MethodDescription
triggersDefines the source group and the source entity types the schema should process.

triggers

Defines the source group and the source entity types the schema should process.

triggers(sourceGroupAlias, sourceEntityTypes)

Parameters

ParameterTypeDescription
sourceGroupAliasstringThe alias of the source group you want your schema to trigger on
sourceEntityTypesstring[]A list of source entity types you want your schema to trigger on

Examples

example of triggers usage
triggers: function(context) {
context.triggers('cms', ['contentPage', 'articlePage']);
}
triggers can also be expressed as an arrow function expression to make it even more compact
triggers: (context) => context.triggers('cms', ['contentPage', 'articlePage'])