Actions
What is an action?
An action defines what a rule does when it executes : it writes a value into the target field. The available actions depend on the type of the target field.
Actions are always part of a rule. A rule can have conditions to control when the action executes, or no conditions at all, in which case the action always executes.
Actions by field type
TEXT
Applies to: IDENTIFIER, SINGLE-LINE-TEXT, LONG-TEXT, HTML-TEXT.
Allowed source fields:
IDENTIFIERSINGLE-LINE-TEXTLONG-TEXTHTML-TEXTNUMBER- the.is used as a decimal separator and cannot be customizedSINGLE-SELECT- choose betweenkey,title, ortitle-localMULTIPLE-SELECT- same as above, values joined by;MULTIPLE-SELECT-QUANTIFIED- joined by;using[quantity]:[value]MULTIPLE-SELECT-QUANTIFIED-WITH-COMMENT- joined by;using[quantity]:[value],[comment]CLASSIFICATION- choose betweenkey,title, ortitle-localIMAGE- the public URL of the file is usedATTACHMENT- the public URL of the file is used
xml
<Action type="SET_TEXT">
<Copy source="DESCRIPTION" remove-carriage-returns="true" trim-spaces="true" />
</Action>1
2
3
2
3
xml
<Action type="SET_TEXT">
<Value>Hello world</Value>
</Action>1
2
3
2
3
xml
<Action type="SET_TEXT">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[{{ targetItem.fields.DESCRIPTION.value.data }}]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
For advanced formulas, see Templates.
CLASSIFICATION
Applies to: CLASSIFICATION.
Allowed source fields:
SINGLE-SELECTMULTIPLE-SELECTMULTIPLE-SELECT-QUANTIFIEDMULTIPLE-SELECT-QUANTIFIED-WITH-COMMENTCLASSIFICATION
If you need to use a TEXT or NUMBER field as source, see Mapping use cases.
xml
<Action type="SET_CATEGORY">
<Map source="TYPOLOGY">
<Entry source="laveVaisselle" target="DISHWASHER" />
<Entry source="frigo" target="FRIDGE" />
<Entry source="réfrigérateur" target="FRIDGE" />
<Entry source="congélateur" target="FREEZER" skip="true" />
<Entry source="four" skip="true" />
</Map>
</Action>1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
xml
<Action type="SET_CATEGORY">
<Value>FRIDGE</Value>
</Action>1
2
3
2
3
NUMBER
Applies to: NUMBER.
Allowed source fields: NUMBER.
If you need to use a TEXT field as source, see Mapping use cases.
xml
<Action type="SET_NUMBER">
<Copy source="PRICE" precision="2" round="UP" />
</Action>1
2
3
2
3
xml
<Action type="SET_NUMBER">
<Value>12.3</Value>
</Action>1
2
3
2
3
xml
<Action type="SET_NUMBER">
<Template precision="0" round="CEILING" engine="twig.2">
<![CDATA[{{ targetItem.fields.PRICE.value.data * 1.20 }}]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
For advanced formulas, see Templates.
Suffixes
When the target field is a Number with suffixes, you can set the suffix to be applied with the value. A single suffix can be set per rule.
If you need to automate a number with distinct suffixes:
- Use conditions on the suffix : see Conditions
- Or create one rule per target suffix
xml
<Action type="SET_NUMBER">
<Copy source="PRICE" precision="2" round="UP" suffix="EURO" />
</Action>1
2
3
2
3
Rounding methods
See Rounding methods.
SINGLE-SELECT and MULTIPLE-SELECT
Applies to: SINGLE-SELECT and MULTIPLE-SELECT.
Allowed source fields:
SINGLE-SELECTMULTIPLE-SELECTMULTIPLE-SELECT-QUANTIFIEDMULTIPLE-SELECT-QUANTIFIED-WITH-COMMENTCLASSIFICATION
If you need to use a TEXT or NUMBER field as source, see mapping use cases.
xml
<Action type="SET_OPTION">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[{{ targetItem.fields.BRAND.value.data }}]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
xml
<Action type="SET_OPTIONS">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[{{ targetItem.fields.ADDED_VALUE.value.data | json_encode }}]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
xml
<Action type="SET_OPTION">
<Template trim-spaces="true" engine="twig.2">
<![CDATA["OPTION-KEY"]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
xml
<Action type="SET_OPTIONS">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[["OPTION-KEY","OPTION-KEY"]]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
For advanced formulas, see Templates.
MULTIPLE-SELECT-QUANTIFIED and MULTIPLE-SELECT-QUANTIFIED-WITH-COMMENT
Applies to: MULTIPLE-SELECT-QUANTIFIED and MULTIPLE-SELECT-QUANTIFIED-WITH-COMMENT.
Allowed source fields:
SINGLE-SELECTMULTIPLE-SELECTMULTIPLE-SELECT-QUANTIFIEDMULTIPLE-SELECT-QUANTIFIED-WITH-COMMENTCLASSIFICATION
If you need to use a TEXT or NUMBER field as source, see Mapping use cases.
xml
<Action type="SET_OPTIONS">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[{{ targetItem.fields.ADDED_VALUE.value.data | json_encode }}]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
xml
<Action type="SET_OPTIONS">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[{{ targetItem.fields.BATTERY.value.data | json_encode }}]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
xml
<Action type="SET_OPTIONS">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[{{ targetItem.fields.CONNECTOR.value.data | json_encode }}]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
xml
<Action type="SET_OPTIONS">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[["OPTION-KEY","OPTION-KEY"]]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
xml
<Action type="SET_OPTIONS">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[[{"key":"AA","quantity":2},{"key":"AAA","quantity":4}]]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
xml
<Action type="SET_OPTIONS">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[[{"key":"USB","quantity":2,"comment":"3.2"},{"key":"USB","quantity":1,"comment":"C"}]]]>
</Template>
</Action>1
2
3
4
5
2
3
4
5
For advanced formulas, see Templates.
IMAGE
Applies to: IMAGE.
Allowed source fields: IMAGE
xml
<Action type="SET_IMAGE">
<Copy source="FRONT" width-px="1000" height-px="1000" quality="90" format="jpg" />
</Action>1
2
3
2
3
ATTACHMENT
Applies to: ATTACHMENT.
Allowed source fields: ATTACHMENT.
xml
<Action type="SET_ATTACHMENT">
<Copy source="INSTRUCTIONS" />
</Action>1
2
3
2
3
DATE and DATE-TIME
Applies to: DATE and DATE-TIME.
Allowed source fields:
DATEDATE-TIME
xml
<Action type="SET_TEXT">
<Copy source="DELIVERY_DATE" />
</Action>1
2
3
2
3
COMPOSITE
Actions on COMPOSITE fields are not supported.