This article explains how to configure and use Data Rules in Spotler Connect. You’ll learn what rules are, how to set up conditions using AND/OR logic, and how to define actions that run when conditions are met. Use Data Rules to automate updates to orders, products, contacts, and other objects.
On this page you have the following options:
- Rules in Connect
- Conditions (the 'if this')
- AND and OR statements
- Actions (the 'then that')
- Testing the Data rule
Rules in Connect
Rules are an ‘if this, then that’ application. A rule consists of conditions (the ‘if this’), and actions (the ‘then that’). When the specified conditions are met, the actions are performed. It’s important to note that multiple ways to set up the same rule often exist.
While the rule builder in Connect doesn’t require coding skills and rules are clicked together in an interface, it’s essential to understand the condition and action you’re setting up in ‘normal language'. For clarity, the examples below have been typed out, even though the actual rule-building is click-based.
Conditions (the 'if this')
You can select several types of conditions in the rule builder. They are listed in the accordion below.
You can select this type of condition when you want to filter based on whether a field is filled with the value YES or NO.
An example of a condition specified like this could be: ‘If the field Virtual in an order is filled with YES, then…’.
You can select this type of condition if you want to filter based on a date, or date range. Operators such as is equal to (for exact dates) or is between (for date ranges) can be used.
An example of a condition specified like this is: ‘If the field Created at in an order is between 4/1/2024 and 4/1/2025, then…’.
Please note
It’s currently not possible to make a date condition that has the operator not between. To circumvent this, a combined condition with AND can be used. For example: If you want a condition that only selects orders not placed between 4/1/2024 and 4/1/2025, you would specify: ‘If the field Created at in an order is equal to or less than 4/1/2024 OR if the field Created at in an order is equal to or greater than 4/1/2025, then…’.
You can select this type of condition if you want to create a condition based on whether a field has a value or not. This condition is different from those based on a yes or no value or field content, as it only depends on whether there is any value present.
An example of a condition specified like this is: ‘If the field Tracking URL on an order is EMPTY, then…’.
You can select this type of condition if you want to create a condition based on metadata present in your data. Metadata is data that is not included in Connect’s basic data model but is added separately by plugins or developers. This option allows for maximum flexibility.
To set up a metadata condition, follow these steps:
- Look up the field name you want to work with. The field name can be found at the bottom of the list view of the data object (an order, product, contact, etc.). The fields included in the object’s metadata are in bold. Copy the name, and ensure that Meta. is added as a prefix. For example: the full field name for the metadata vat_number is Meta.vat_number.
- Select the operator (is equal to, starts with, is greater than, etc.).
- Fill out the value you want to check the condition on.
- Select a data type that needs to be coerced for the input and value. If uncertain or if there is no specific use case for a data type, leave this setting on MIXED.
An example of a metadata condition could be: If Meta.vat_number of type MIXED is equal to 2222, then…’.
You can select this type of condition to filter on a range. For example: ‘If the field Value of order in an order is between 100 and 150, then…’.
Please note
It’s currently not possible to make a range condition that has the operator not between. To circumvent this, a combined condition with AND can be used. For example: If you want to create a condition that only selects orders with a value not between 120 and 150, you would specify: ‘If the field Value of order in an order is equal to or less than 120 OR if the field Value of order in an order is equal to or greater than 150, then…’.
You can select this type of condition if you want to filter on the actual content of a field. The exact content matters, and various operators can be chosen, such as is equal to, starts with, does not contain, etc.
An example of a condition specified like this would be: ‘If the field Order status on an order is equal to Returned, then…’ or ‘If the field Sku on a product does not start with 01_, then…’.
AND and OR statements
Working with AND and OR statements in both conditions and actions is possible. This allows you to either fine-tune when a rule will be applied or combine multiple rules with the same outcome in one rule. When you use AND statements, the data object (order, product, etc.) needs to satisfy both conditions or actions, while for OR statements, only one (or one of) the others needs to be satisfied.
Nesting AND and OR statements
It’s also possible to nest AND and OR statements. When you create the first condition or action, a button will appear below them. This allows you to add a second condition or action with the AND statement.
For example, you can combine a condition that selects Products with the word 'Download' in the product name with a condition that selects products with the Product status 'Active'. Together, this will form the condition ‘If the field Product Name on a product contains Download AND the Product status is Active, then…’. You can then combine this with an OR statement to further expand the condition.
Actions (the 'then that')
Actions are the operations that are performed after a condition, or a certain set of conditions, have been met. These actions are versatile, and can be expanded with AND and OR statements. There are several categories of actions:
- Change data
- Stop Data processing
- Send Email
- Send webhook
Change data
As an action, data and metadata can be changed in many ways. Each option is explained in the accordion below.
You can select this action if you want to change the value of a field to either YES or NO. Only fields that accept a YES or NO input (so-called Boolean fields) can be selected here.
An example of this action is: “… then the value of the field Virtual on an order will be set to YES.”
You can select this action if you want to do math on a field once a specific condition is met. You can perform the following actions:
- Add: The value of the selected field is increased by the number entered (for example: “The Value of an order is increased by 10”).
- Subtraction: The value of the selected field is decreased by the number entered (for example: “The Value of an order is decreased by 10”).
- Multiply: The value of the selected field is multiplied by the number entered (for example: “The Value of an order is increased by 1.1 (i.e. 10%)”). You can also decrease the value by multiplying it with numbers below 1.
- Decimal count: The value of the selected field is rounded to the number of decimals specified.
An example of this action would be: “… then the value of the field Value of order on an order will be multiplied by 1.25.”
You can select this action if you want to change a date on a data object (order, product, contact, etc.). Please note that only fields that accept a date as input can be selected here.
An example of this action is: “… then the field Shipment date for an order will be set to 1/1/2025.”
You can select this action if you want to completely remove an object of your data. Objects are groups of data that contain multiple fields. For example, an orderline on an order contains a product, a quantity, and pricing data. The possible objects to discard are:
- For Orders & Checkouts:
- Orderline
- Discount codes
- For Products:
- Categories
- Images
- Tags
- For Contacts:
- Customer Group
- Tags
By discarding this object you discard all data in this object.
An example of this action is: “… then the object Orderline on an order will be discarded.”
Removing a field value empties the value that is in a specified field and sets it to null. This means the field will still be propagated through the connector, but without a value in it.
An example of this action is: “… then the value of field Gender will be set to null.”
You can select this action to change a metadata value based on a specific condition.
To set up a metadata action:
- Look up the field name you want to work with. Fields included in the object’s metadata are in bold at the bottom of the list view of a product, order, contact etc. Copy the name and prefix with 'Meta.' (e.g. Meta.vat_number).
- Select the operator (is equal to, add, divide, etc.).
- Fill out the value you want to check the condition on.
- Select a data type to coerce the input and value. If uncertain, leave this setting on MIXED.
To simply set a metadata value, use the operator ‘=’. For example: “… then Meta.vat_number = NL000099998B57.”
Adding a value to a field means adding a prefix or postfix to the existing value in a field. This is useful if a hyperlink or URL is incomplete and only contains the path. This action could also add website extensions, abbreviations like B.V. or ltd to companies, etc.
For example: “… then add https://webshop.com/ before existing value in field Product URL.”
This action allows you to remove a value from a field. This also works for part of values. For example, when an external system always puts ‘Mrs’ or ‘Mr’ in front of the First Name in an order, you can use this action to remove ‘Mrs’ or ‘Mr’ from this field before exporting it to another system.
An example: “… then ‘Mrs’ will be removed from First Name.”
This action allows you to overwrite any field value completely and set it to a new one, for both empty and already filled fields.
An example of this action would be: “… then the value for field ServiceLevel = GLS worldwide.”
This function allows you to hash the value of a field and save it as the field value. You can select various hashing algorithms and other functors. For example, you can choose this action to send a hash of a contact’s email in the metadata of a contact, so this hash can be used in an external platform.
This is an advanced function that requires programming knowledge. If you want to use this action, it’s recommended that you contact support to assist.
Formatting a field value means that you can combine variables from different fields by using string formatting. This is an advanced function that requires programming knowledge. If you want to use this action, it’s recommended that you contact support to assist.
For more information on string formatting, see Rust’s formatting documentation.
Formatting a date value means that you can combine variables from different fields by using date formatting. This is an advanced function that requires programming knowledge. If you want to use this action, it’s recommended that you contact support to assist.
For more information on date formatting, see Rust’s date formatting documentation.
Stop data processing
It’s possible to stop the import or export of data when a specific condition or set of conditions is met. Effectively, this is a stop button.
It’s recommended that this action be followed up with another action, such as the Send email action (see below). Combining these actions will send a notification whenever the data processing is stopped, preventing issues with synchronicity.
Send email
It’s possible to send a custom email notification. This can be used as a stand-alone notification system (i.e. whenever a condition is met, send an email), or as an AND action following up on a data change or data stop.
When you select this option, you can add multiple email addresses to receive a message.
Send webhook
Another possibility is to send a webhook as an action. A webhook allows Spotler Connect to send real-time data to another platform when a specific event occurs. Instead of constantly checking if something happened, the webhook automatically notifies you when it does.
When you want to send a webhook, you can enter the following:
- URL endpoint: The URL the webhook needs to post to.
- Optional: Username and Password. When you want to encrypt the webhook, you can enter credentials here.
- Optional: Headers. You can add multiple headers with a key-value pair to the webhook.
When you fill out the URL, the option to test a webhook becomes available. This allows you to select a data object (a product, order, etc) and check which webhook response is created.
Testing the Data rule
The Rules Tester Tool is designed to provide an intuitive and interactive way for users to test, validate, and debug rules within the system. It serves as a lightweight utility focused on simplifying how users interact with the underlying logic of rule evaluation, ensuring that configurations behave as expected without requiring deep technical knowledge or manual data preparation.
You can find this feature in the Data rules module from the left panel of Connect. On the right of the search bars, you see a new Test button. Click on it to open the test wizard. The pop-up provides several options for testing rules:
- Choose whether you want to test an incoming or outgoing rule.
- Select the connector. Only the active connectors in the account will appear in the dropdown.
- Based on the selected connector, the available streams will be dynamically displayed. These streams correspond to those active in the connector's configuration. For example, the Product stream is available for Mail+, but if it isn't activated in that connector's setup, it will not appear as a selectable option.
- Finally, choose the entity you want to test against to complete the configuration.
- The test results will be displayed for the selected record. At the top of the results section, you'll see a list of all the rules that were applied. Below that, the affected records will be shown, highlighting the before and after values for each change.