This article covers some advanced mapping scenarios that requires JavaScript configurations. As a prerequisite, please review our schema converter format, which explains the `$[0]` structure that is sometimes used. A basic understanding of JavaScript may also be helpful.
Mapping custom fields
Let's say that when we ingest an order from an integration, we want to indicate in the custom fields that it came from that integration. Let's add a custom field with the key `sourceChannel` and value `IntegrationA`.
- Find the existing baseline mapping for orders into Pipe17 that maps to the Pipe17 customFields field. For example, for Amazon Seller Central, the source mapping looks like this:
- The result of this baseline mapping is an array with objects in the { name, value } format. Now, let's reconfigure this mapping to add `{ name: "sourceChannel", value: "amazonSC" }` after processing the baseline mapping logic.
The logic simply appends to the customFields array after the baseline mapping logic is processed.
- We can conduct a simple test to verify that the modification is working as intended.
The JSON output now includes the custom mapping we have applied.
Mapping order tags
The logic to map order tags is similar to mapping custom fields. Let's modify the baseline mapping for mapping Shopify tags to Pipe17 by appending the tag "Pipe17".
- Locate the baseline mapping that maps Shopify order tags to the Pipe17 order `tags` field.
- Pipe17 tags are an array of strings, e.g. ["Tag1", "Tag2", "Tag3"]. Let's add "Pipe17" after the baseline mapping logic executes.
- Let's verify that the mapping works. As you can see, the JSON output now has the "Pipe17" tag in addition to the other tags defined on the Shopify order source document.
Clipping fields
Let's say that you are trying to push products out of Pipe17 to Logiwa. It so happens that one of your products has a really long description, so Logiwa is returning an error when we attempt to publish the product due to the description being greater than 500 characters. In this situation, we can:
- Update the product in the e-commerce channel from where it was ingested, pull the product into Pipe17, and re-attempt pushing the product out.
- Or, we can truncate the product description so that it does not exceed the character limit.
Generally, we recommend the first approach to have consistency across platforms, but if you are looking for a quick fix, you can apply the following change to ensure that the description does not exceed 500 letters.
Comments
0 comments