Skip to main content

Commercetools Mapping Functions

Reference for the Commercetools-specific functions you can use in Dynamic Formula mappings and mapping collection filters.

Overview

The Commercetools integration provides a set of ready-made functions you can call when building mappings. They handle common lookups and conversions between your iPaaS.com data and Commercetools, such as matching categories, resolving a product type or tax category by name, and mapping a location ID, so you do not have to write that logic yourself in a formula.

Where you can use these functions

These functions are available anywhere you write a formula for the Commercetools integration:

  • Dynamic Formula mappings: where a destination field's value is produced by a formula rather than mapped directly from a source field.

  • Mapping collection filters: where a formula decides whether a record should be processed.

  • Error filters: a mapping collection's error filter, which sits alongside its collection filter. When the error filter's formula resolves to true, the transfer raises an error that is held in the Error Logs for review and is not retried automatically.

  • Translation collections: where a translation entry uses a formula as its source value.

How to use them

  • Call a function by name and pass the values it needs in parentheses, for example: await GetProductTypeIdFromName(SourceType).

  • Each function's signature shows its name, the parameters it accepts (with their types), and the type of value it returns. Use it as the reference for exactly how to call the function.

  • Function names and formula syntax are case-sensitive, so type each name exactly as shown. Whether the values a function matches are treated as case-sensitive varies by function, and is called out in the relevant parameter's description.

  • Every function that returns a Task is asynchronous and must be called with await, as shown in each How to call it example.

  • Each function runs at sync time, against the data in your connected Commercetools account and your iPaaS.com subscription.

The functions are grouped below by the area of the integration they support.

Categories

ConvertCategoriesToCommerceToold

What it does: Takes a set of iPaaS.com category assignments and returns the matching Commercetools categories. It maps each iPaaS.com category to its linked Commercetools category ID and returns the matched category records.

Signature: Task<List<Category>> ConvertCategoriesToCommerceToold(object categories)

How to call it: await ConvertCategoriesToCommerceToold(categories)

Parameter

Type

Required

Default

Description

categories

object

Yes

N/A

One or more iPaaS.com category assignments, in the iPaaS.com category format.

Returns: List<Category>. The matched Commercetools categories, each with its Commercetools ID, name, and key. Categories that cannot be mapped are skipped.

Example: [{"id": "55338|1001", "category_id": 1001, "category_name": "Electronics"}] returns the matching Commercetools category records.

When to use it: Use this in the product flow to map iPaaS.com category assignments to their linked Commercetools categories so a product is placed in the correct categories.

ConvertCatToCom

What it does: Takes a set of iPaaS.com categories and returns the Commercetools categories whose name matches, enriched with their Commercetools ID, name, and slug. Unlike the ID-based mapping, this function matches on the category name.

Signature: Task<object> ConvertCatToCom(object category)

How to call it: await ConvertCatToCom(category)

Parameter

Type

Required

Default

Description

category

object

Yes

N/A

One or more iPaaS.com categories, in the iPaaS.com category format (with fields such as id, category_id, and category_name).

Returns: object. A list of the matched Commercetools categories, each with its Commercetools ID, name, and slug. Categories with no name match are skipped.

Example: [{"id": "55338|15834", "category_id": 15834, "category_name": "Electronics"}] returns the Commercetools categories whose name matches.

When to use it: Use this when you want to match iPaaS.com categories to existing Commercetools categories by name rather than by their mapped ID.

Products

GetProductTypeIdFromName

What it does: Looks up a Commercetools product type by name and returns its Commercetools product type ID.

Signature: Task<object> GetProductTypeIdFromName(string type)

How to call it: await GetProductTypeIdFromName(type)

Parameter

Type

Required

Default

Description

type

string

Yes

N/A

The product type name to resolve to a Commercetools product type ID.

Returns: object. The Commercetools product type ID (a string) for the given product type name.

Example: "Electronics" returns the Commercetools product type ID for the Electronics product type.

When to use it: Use this when creating or updating a Commercetools product and you have the product type by name but need its Commercetools product type ID.

ConvertTaxClassNameToCommerceTaxClassId

What it does: Looks up a Commercetools tax category by name and returns a tax category reference containing its ID and type.

Signature: Task<ProductTaxCategory> ConvertTaxClassNameToCommerceTaxClassId(string taxClassName)

How to call it: await ConvertTaxClassNameToCommerceTaxClassId(taxClassName)

Parameter

Type

Required

Default

Description

taxClassName

string

Yes

N/A

The iPaaS.com tax class name to match against Commercetools tax categories.

Returns: ProductTaxCategory. The matching Commercetools tax category, with its ID and a type of tax-category. If no tax category matches the name, the returned object's ID and type are not set.

Example: "Standard Rate" returns the Commercetools tax category reference for the tax class named Standard Rate.

When to use it: Use this when a Commercetools product needs its tax category set from an iPaaS.com tax class name.

Locations

ConvertiPaaSLocationIdToCommerceId

What it does: Maps an iPaaS.com location ID to the linked Commercetools location ID.

Signature: Task<string> ConvertiPaaSLocationIdToCommerceId(object locationId)

How to call it: await ConvertiPaaSLocationIdToCommerceId(locationId)

Parameter

Type

Required

Default

Description

locationId

object

Yes

N/A

The iPaaS.com location ID to map, typically a string or numeric identifier.

Returns: string. The Commercetools location ID linked to the iPaaS.com location ID. If no matching Commercetools location is found, the function raises an error.

Example: "LOC-1001" returns the Commercetools location ID mapped from that iPaaS.com location.

When to use it: Use this when inventory, warehouse, or fulfillment data references an iPaaS.com location and you need the matching Commercetools location ID so stock or order routing is associated with the correct location.

Related Documents

Did this answer your question?