Mapping rules can be thought of as mini workflows that can be applied to a specific field in a mapping template. Mapping rules modify values after they have been mapped by the template via conditions and actions.
As detailed in the mapping overview, rules are generally used when you want to conditionally modify a value being mapped via a mapping template.
Terminology
- Incoming Value: since mapping rules are meant to be applied to fields, the incoming value represents the value that is being manipulated by the rule. It's worded as "incoming" because you can chain mapping rules together, and this value transmits through each chained rule
- Original Value: this value represents the original value that was mapped from the field. This can be used to back out of the changes in certain situations
Example |
Perhaps you want to apply title cleanups to every brand except "XYZ". In this case, you could create a rule: → Apply cleanups to all titles → If Brand = XYZ → Set Title to Original Value |
Creating Mapping Rules
Rules can be set-up similar to workflows by running if/then conditions or by doing a tiered Rule Type.
Rule Types
Conditional: Applies rules based on "If" and "Then" conditions
- With Conditional, you'll have the option to select the following Input Types:
- String
- Number
- Boolean
- Option Field
Tier: Applies rules based on a tiered list that can either be marked up or marked down.
In this example, the Get Inventory [Primary] rule will sentence case the titles.
Testing Mapping Rules
Once you've created a mapping rule, you can test it to ensure it's working as intended. To test a mapping rule, click the Test Rule button.
Testing a workflow rule will ensure the conditions are working as you expect when given sample data.
Info |
Testing a workflow only requires the data that is leveraged within a given rule. In the above example, since we only interacted with brand and the incoming value (which represents the title), we only had to populate these values to test. |
Applying Mapping Rules
When adding a mapping rule in a mapping template by clicking "New Rule", once a mapping rule is created, it will automatically be applied to the field in the mapping template (as shown above).
If you create the rule outside the mapping template, then you will need to manually add the rule to the field you'd like to apply it to. To apply a mapping rule, navigate to the field you're attempting to modify, click Rules → View All Rules → Add on the specific rule you'd like to use.