Skip to main content

Clover Mapping Functions

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

Overview

The Clover integration provides a set of ready-made functions you can call when building mappings. They handle common conversions and lookups for Clover, such as converting between date-time values and the Unix millisecond timestamps Clover uses, totaling order line quantities, and resolving a product SKU from a Clover 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 Clover 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 ProductSkuByExternalIdAsync(SourceId).

  • 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.

  • Some of these functions are asynchronous (their signature returns a Task) and must be called with await; the rest are synchronous and are called directly. Each function's How to call it example shows the correct form.

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

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

Dates and Times

ConvertToUnixTime

What it does: Converts a date-time value into a Unix timestamp in milliseconds, the format Clover uses for times.

Signature: Int64 ConvertToUnixTime(object input)

How to call it: ConvertToUnixTime(input)

Parameter

Type

Required

Default

Description

input

object

Yes

N/A

The date-time to convert. It must be a DateTime value; any other type raises an error.

Returns: Int64. The Unix timestamp in milliseconds elapsed since 1970-01-01 UTC.

Example: A DateTime of 2023-09-26 14:28:07 UTC returns its Unix millisecond timestamp.

When to use it: Use this when a Clover field needs a time expressed as a Unix millisecond timestamp.

ConvertFromUnixTime

What it does: Converts a Unix timestamp in milliseconds into a date-time value in UTC.

Signature: DateTimeOffset ConvertFromUnixTime(object input)

How to call it: ConvertFromUnixTime(input)

Parameter

Type

Required

Default

Description

input

object

Yes

N/A

The Unix timestamp in milliseconds. It must be an Int64 value; any other type raises an error.

Returns: DateTimeOffset. The UTC date-time represented by the Unix millisecond timestamp.

Example: 1695740887000 returns the UTC date-time 2023-09-26T14:28:07+00:00.

When to use it: Use this to turn a Clover Unix millisecond timestamp into a date-time value for a mapping.

Orders

GetTotalUnitQty

What it does: Adds up the unit quantities of a set of order line items, counting any line whose quantity is 0 as 1000.

Signature: long GetTotalUnitQty(object input)

How to call it: GetTotalUnitQty(input)

Parameter

Type

Required

Default

Description

input

object

Yes

N/A

The order line items to total. It must be a List<OrderLineItem>; any other type raises an error.

Returns: long. The total unit quantity, where any line item with a quantity of 0 is counted as 1000.

Example: Line items with quantities 10, 0, and 5 return 1015 (the 0 is counted as 1000).

When to use it: Use this when a Clover order mapping needs the combined unit quantity across its line items and a zero quantity should be treated as 1000.

Products

ProductSkuByExternalIdAsync

What it does: Resolves a Clover product's external ID to the matching iPaaS.com product and returns that product's SKU.

Signature: Task<string> ProductSkuByExternalIdAsync(object externalId)

How to call it: await ProductSkuByExternalIdAsync(externalId)

Parameter

Type

Required

Default

Description

externalId

object

Yes

N/A

The Clover external ID of the product. Typically a string, but any value convertible to a string is accepted.

Returns: string. The iPaaS.com product SKU, or null if no mapping or product is found for the Clover ID.

Example: "12345" returns the SKU of the iPaaS.com product mapped to that Clover ID.

When to use it: Use this when a mapping references a product by its Clover ID and you need the matching iPaaS.com product SKU.

Related Documents

Did this answer your question?