Skip to main content
All CollectionsAdvanced Topics
Advanced Import mapping & transformations
Advanced Import mapping & transformations

When data should be modified during import or trigger actions like categorization or user group assignment, use import mapping

Michael Fatica avatar
Written by Michael Fatica
Updated over 7 months ago

This article describes features available to Enterprise users only.

Find Import mappings under Tools > Import Mapping, the following screen lists any existing mappings. To create a new mapping, click New.

Category Mapping

In some cases, users would like rows to be added to a category if a field contains a certain value. This mapping type is Category.

For example, if the FavoriteColor column contains the value 'red', assign the row to the category with ID 25, if the FavoriteColor column contains the value 'blue', assign the row to the category with ID 26.

Wildcards are supported in the value field. E.g. red* would match any value starting with the word red, e.g. reddit, redacted. The value gr[ae]y would match grey or gray and so forth.

When mapping a column in the incoming data that is not a field, but instead a category column, the "Field Name" must be tag1. This mapping would then only apply to categories that appeared in the first category column.

Transformation Mapping

If a value should be modified programmatically during the bulk import, a Twig template can be applied to the data. The mapping type must be set to Transformation and the transformation will be applied to the value set in the Field Name.

The template is a Twig template, which can perform simple (and not-so-simple) transformations of the incoming data.

A few examples:

Replace any dashes found in the field value with dots:

{{ template_item.value|replace({'-':'.'}) }}

Remove any values greater than 5 characters in length:

{% if template_item.value|length <= 5 %}{{template_item.value}}{% endif %}

Remove any email fields without an @ sign.

{% if '@' in template_item.value %}{{template_item.value}}{% endif %}


Concatenate two fields into the Name field

{% if template_item.data.firstname %}{{template_item.data.firstname}} {{template_item.data.lastname}}{% endif %} 

User Group Mapping

When importing data, you can create a mapping to automatically assign a row to a user group.

Create a new Mapping and choose UserGroupId as the Mapping Type.

For example, if the Division column in your incoming data contains the value 'retail', assign the row to the User Group with ID 1, if the Division column contains the value 'commercial', assign the row to the User Group with ID 2.

Wildcards are supported in the value field. E.g. retail* would match any value starting with the word retail, e.g. retailers, retailor. The value gr[ae]y would match grey or gray.

The first example above would require a mapping as shown:

Job Mappings

It can be useful to perform a transformation on a column that is not coming from a specific data source. This is useful when you want to apply a transformation but you do not control the fields in the data source, such as when importing from SalesForce or Google My Business.

Examples include

  1. All records coming from Google My Business should have the custom field named "Segment" set to "GMB"

  2. All records coming from SalesForce should have the Name field set to the First Name plus the Last Name with a space in between.

In the above examples the Name and Segment columns aren't coming from the data source mentioned, they are custom fields in the MetaLocator account.

These mappings are done on a per-background-job basis, and can be configured as show below.

Example 1

Example 2

Linking Mappings

Import Mappings can not be linked, or otherwise inform one-another. For example, you can not use a Transformation Mapping to modify a field value, and then create a Category Mapping based on the results of the Transformation Mapping. All mapping rules operate on the data as it appears in the import file.

Did this answer your question?