Mappings define how fields in another system's records correspond to fields in Pipe17. For example, the Shopify order field name maps to the Pipe17 Order ID. Pipe17 provides baseline mappings for every connector, and you can customize them for a single integration: change how a field is filled, turn a mapping off, or map extra fields.
Mappings control how data flows between your systems. Test every change before you save it, and watch the first records that use it.
How mappings work
Baseline mappings
Baseline mappings are maintained by Pipe17 for each connector. They're shared by every integration that uses the connector, and Pipe17 versions them, so you can compare your mappings with earlier versions.
Custom mappings
Custom mappings change the baseline for one integration only. Each mapping row writes to a target field, and Pipe17 combines your rows with the baseline by target:
- If your row has the same target as a baseline row, yours replaces it. The row shows an Override badge.
- If no baseline row has that target, your row is added at the bottom. It shows a New badge.
- Baseline rows you haven't changed show a Baseline badge. Rows you turned off show Disabled.
For example, the Shopify baseline maps the product status to the Pipe17 product status. If you add your own rule with the target status, your rule is used for that integration instead of the baseline one.
You can customize mappings to change how a baseline field is filled, turn off a baseline mapping you don't need, or map fields the baseline doesn't include.
Open an integration's mappings
- Go to Configure > Integrations and click the integration.
- Select the Mappings tab. It reads Mappings (Customized) when the integration has custom mappings.
- Choose the record type (for example Orders or Products) and the direction: From the other system into Pipe17, or To the other system.
Each row shows the source on the left and the Pipe17 target on the right. Use the options above the rows to filter them:
- All mappings: the combined result of the baseline and your changes.
- Custom mappings: only your changes, including baseline mappings you turned off.
- Include disabled: also show rows that are turned off.
The search icon finds rows by source or target. The ⋮ menu has Compare mappings, View samples, View documentation (field references), View JSON, View mapping event log, Export and Import.
Change mappings
- Change a source: pick a different field in the source dropdown, or click the code icon (<>) to edit the source as JavaScript in the Edit code window.
- Add a mapping: click Add mapping, then choose a source and a target. Check ⋮ > View documentation to see which fields each system has.
- Turn off a baseline mapping: click Disable mapping on the row.
- Undo an override: click Revert mapping to default on the row. To remove a row you added, click Delete custom mapping.
Your changes aren't applied until you click Save changes. Click Discard changes to throw them away.
Advanced options
Click Set advanced options under a row to add a Lookup table, a Default Value or a Missing value.
-
Lookup: replaces the source result with a matching value. The keys are the exact source values, for example
{"active": "active", "draft": "inactive"}. - Default Value: used when the source result is null, or when it's undefined and no Missing value is set.
- Missing: used when the source result is undefined (for example, the field doesn't exist) or when the lookup finds no match. It isn't used for null.
Enter "" in Default Value or Missing to set an empty string.
Example: Shopify product status
The Shopify baseline maps a product's status to the Pipe17 product status. The lookup turns active into active, and draft or archived into inactive. The Missing value is active, so a product with no status, or a status the lookup doesn't know, is still imported as active.
Test mappings
Test your changes before you save them. The test uses the mappings as they are on screen, including unsaved changes.
- Click Test next to Add mapping.
- In the test window, click Load most recent to load the latest record Pipe17 received, or choose Pipe17 ID or External ID and enter an ID. You can also paste a document into Editable JSON Input.
- Click Test mappings and check the result in JSON Output.
If a rule fails, the window shows how many rules failed, and Copy error details copies the reasons.
Compare and restore versions
- Click ⋮ > Compare mappings.
- In Compare current with, choose an earlier version. The window shows the differences side by side.
- To go back to that version, click Revert to selected version. Only some versions can be restored, such as the latest baseline release or a custom version based on it.
Monitor your changes
- Check the first records that use the new mapping on Monitor > Events. For example, after changing Shopify order mappings, look at the events for new Shopify orders. See Understanding Portal Logs (Events).
- Use ⋮ > View mapping event log to see the events for this mapping.
- To limit the impact while you test, set the integration's settings to pull only test orders.
Mapping syntax reference
This section is for users who write sources as JavaScript. For worked examples, see Advanced Mapping Scenarios.
Rule structure
Each mapping row is a rule. In ⋮ > View JSON or an export, a rule looks like this:
{
"name": "Order ID",
"enabled": true,
"source": "name",
"target": "extOrderId"
}-
name: a description of the rule. -
enabled:trueto run the rule,falseto skip it. -
source: a field path or a JavaScript expression that produces the value. -
target: the field path in the resulting record. - Optional:
lookup,defaultandmissing, which match the advanced options above.
Rules run from top to bottom.
Fields and expressions
- A source can be a field name such as
displayName, or a path such ascustomer.email. - A source can be any JavaScript expression, for example
customer.firstName + ' ' + customer.lastNameorpaid ? 'completed' : 'pending'. -
For longer logic, use a function that runs immediately:
((order) => order.subtotal * 0.08)(sourcedoc) - To convert a value, use JavaScript, for example
Number(quantity)orString(customerId).
A field name on its own (such as title) only works when that field exists in the record. When a field might be missing, use sourcedoc.title, and use ?. for paths whose middle part might be missing, such as customer?.contact?.email. Otherwise the rule fails, and Default and Missing aren't applied.
For example, sourcedoc.title || sourcedoc.name falls back to the name when there's no title, and (sourcedoc.items || []).length returns 0 when there are no items.
Arrays
Use [$0] to apply a rule to every item in an array. The same iterator must appear in both the source and the target:
{
"name": "Line item SKU",
"enabled": true,
"source": "line_items[$0].sku",
"target": "lineItems[$0].sku"
}For nested arrays, use a second iterator, such as orders[$0].items[$1].price → allOrders[$0].products[$1].cost. You can use $0 to $9.
Lookup tables
{
"name": "Weight unit",
"enabled": true,
"source": "weight_unit",
"target": "weightUnit",
"lookup": {
"lb": "pounds",
"kg": "kilograms",
"oz": "ounces",
"g": "grams"
}
}The keys are the source values exactly as they come in. If the source value isn't in the table, the Missing value is used, or the target is left out.
Default and missing values
{
"name": "Product type",
"enabled": true,
"source": "sourcedoc.productType",
"target": "type",
"default": "general"
}Here a product whose type is null or missing gets general. If you also set missing, it's used instead of default when the type is missing (undefined), and default then only covers null.
How a rule is evaluated
- The source is evaluated.
- If the rule has a lookup, the result is replaced with the matching value. If there's no match, the Missing value is used; if there's no Missing value, the target is left out.
- If the result is undefined, the Missing value is used, otherwise the Default Value. If neither is set, the target is left out of the record.
- If the result is null, the Default Value is used if set.
- Otherwise the value is written to the target, even if it's null, an empty string or 0.
Pre- and post-processing scripts
A rule whose target is __PIPE17_PRE_RULE__ runs before all other rules, and one whose target is __PIPE17_POST_RULE__ runs after them, wherever they are in the list. Their return values are ignored; use them to prepare sourcedoc or adjust targetdoc:
{
"name": "Post-processing",
"enabled": true,
"source": "(() => { targetdoc.mappedAt = new Date().toISOString(); })()",
"target": "__PIPE17_POST_RULE__"
}Each mapping has at most one pre-script and one post-script. Because rules are matched by target, adding your own replaces the baseline's script, so copy the baseline's code into yours first.
Available variables
-
sourcedoc: the whole source record. -
targetdoc: the record being built. It's only available in pre- and post-scripts. - Top-level field names of the source record, such as
displayName, when that field exists. -
$0to$9: array iterators.
Errors and limits
- If a rule fails, for example because of an invalid expression, the error is logged, that target is left out, and the other rules still run.
- A rule that runs longer than 5 seconds, or a conversion longer than 15 seconds, fails the whole conversion.
- Rules that use
this,eval,import,await,throworglobalare skipped.
Best practices
- Give each rule a clear name.
- Turn a mapping off with Disable mapping rather than deleting it while you test.
- Use Missing, Default Value,
sourcedoc.fieldand?.so missing data doesn't break a rule. - Test with several real records, including unusual ones, before you click Save changes.
Troubleshooting
- A field I mapped is missing from the result.
The source was undefined and no Missing or Default Value was set, or the rule failed. Run Test and check Copy error details. - My lookup never matches.
Lookup keys must match the source value exactly, including case. - My change didn't take effect.
Make sure you clicked Save changes, and that the row isn't disabled. - I want the baseline back.
Click Revert mapping to default on the row, or restore a version with ⋮ > Compare mappings.
Need Help?
If you need additional assistance:
- Use Ask Pippen, our AI agent, located at the top of the platform page.
- Submit a support request with as much relevant detail as possible. Learn how to submit a request.
We're here to help you succeed with your operations.
Comments
0 comments