Each integrator can define Functions that can be called in a dynamic formula. These are built and maintained by the integrator and are documented in the subscription documentation.
This document provides a comprehensive reference for functions available in mapping formulas in iPaaS.com.
The most current list of functions can always be obtained from GET /integrators/v1/DynamicFormulas. That endpoint returns every function registered for your integration version, with its exact signature, parameter names and descriptions, and return type. Every signature, parameter name, and return type on this page is taken from that response. Because functions are registered per integration version, two integrations may not expose the same set - check the endpoint for the version you are working in rather than assuming a function is available.
Table of Contents
Usage Notes
Async Functions
Many functions run asynchronously. These return a Task and must be awaited, or the formula receives a Task object instead of a value.
await GetSpaceportId_StringAsync("ADM-TL2", "Product Inventory", SpaceportSystemId)The Async suffix is not a reliable indicator of whether a function is asynchronous. A number of functions return Task<...> without an Async suffix in the name, including ProductIdFromSku, VariantIdFromSku, ParentIdFromSku, ParentIdFromVariantId, SkuFromAlternateId, UnitFromAlternateId, GetProductType, CustomFieldValue, and the whole AlternateIdFrom... family. Check the return type rather than the name.
Throughout this page, any return type shown as Task<...> must be awaited. Where both a synchronous and an Async version of the same function exist, prefer the async version for better performance under high concurrency or with large datasets; both return the same value.
Error Handling
Functions with a Required suffix, such as CountryCodeRequired, throw an error if no results are found. The standard versions return null or a default value instead. The WithDefault variants let you supply your own fallback.
Deprecated Functions
Avoid using functions marked as deprecated. They remain callable but may be removed in future versions. See Deprecated functions for the current list and its replacements.
Performance Considerations
Use async variants when available for better performance
Prefer specific lookup functions over generic ones when possible
Cache results of expensive operations when feasible
The SpaceportSystemId variable
Functions that take a systemId parameter identify which external system to look up against. SpaceportSystemId is a built-in variable that resolves to your current external system, so you can pass it directly rather than hardcoding an ID.
The related tableName parameter is the name of the data type being looked up, such as Product, Customer, Transaction, or Product Inventory.
Condition strings
Functions that accept a condition parameter, such as FirstMatch and FieldFromFirstMatch, use == for equality. Inner quotes must be escaped.
System Classes
The following standard system classes and their methods are available by default:
System.Math - Mathematical operations and constants
System.String - String manipulation methods
System.Collections.ICollection - Collection operations
System.DateTime - Date and time operations
These come from the runtime rather than the function registry, so they do not appear in the DynamicFormulas response.
Working with null and missing values
Function | Signature | Returns | Notes |
|
|
| First non-null element. |
|
|
| First non-null element, converted to DateTime. |
|
|
| First non-null element, converted to decimal. |
|
|
| First non-null element, converted to integer. |
|
|
| Whether the object is null. |
|
|
| Broader than |
Converting types
Function | Signature | Returns | Example |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To turn a flat string into a list, see Working with lists and collections. To convert between objects and JSON or XML, see Working with JSON, XML, and dictionaries.
Working with dates and times
Function | Signature | Returns | Notes |
|
|
| Current DateTime in the local time zone. |
|
|
| Current DateTimeOffset in the local time zone. |
|
|
| Converts the input to a DateTime or DateTimeOffset, then returns only the date portion. |
|
|
| Local DateTime to DateTimeOffset. |
|
|
| DateTimeOffset to local DateTime. |
|
|
|
|
|
|
|
|
Working with text
Matching
Function | Signature | Returns | Notes |
|
|
| Whether the input matches the regex pattern. |
|
|
| SQL-style likeness comparison. The SQL wildcard |
Transforming
Function | Signature | Returns | Notes |
|
|
| Regex find and replace. Pass an empty string as the replacement to strip every match. |
|
|
| Removes a prefix if present, otherwise leaves the value unchanged. The prefix is the first argument. |
|
|
| The portion of a string after the last occurrence of a character. Useful for parsing compound IDs. |
|
|
| Truncates to the specified maximum length. Use this to fit a destination field limit. |
|
|
| Removes all non-ASCII characters except tabs and carriage returns. |
|
|
| Removes non-printable characters. |
|
|
| MD5 hash of the input. Non-string input is converted to a string first. |
Doing math
The formula engine does not handle nullable numeric types cleanly, so these functions exist to make arithmetic safe. Prefer them over raw operators whenever a value may be null.
Function | Signature | Returns | Notes |
|
|
| The larger of two numeric values. |
|
|
| Null-safe and type-safe division. The denominator cannot be null. Note the parameter spelling, which is how it is registered. |
|
|
| Null-safe and type-safe multiplication. |
To sum a field across a collection, see SumFieldFromCollection in Working with lists and collections.
Working with lists and collections
Reading from a collection
Function | Signature | Returns | Notes |
|
|
| The first object in a collection. |
|
|
| The first object matching the condition. Returns the entire object. |
|
|
| A single field from the first matching object. Use this rather than |
|
|
| A field value by name from any object. |
|
|
| Sums one field across every entry in a collection. |
Building a collection
Function | Signature | Returns | Notes |
|
|
| Turns a string into a list of integers. Use for destination fields that take an array of ints when the source is a flat string or a static mapping. |
|
|
| Same, for arrays of strings. |
|
|
| Parses a JSON string into a list of the destination type, mapping source fields to destination fields via the supplied dictionary. |
Working with JSON, XML, and dictionaries
Function | Signature | Returns | Notes |
|
|
| Parses a JSON string into a string/string dictionary. |
|
|
| The value for a key, or null if the key does not exist. |
|
|
| Converts a JSON string to a dynamic ExpandoObject using Newtonsoft. Use when the shape is not known ahead of time. |
|
|
| Serializes any object to a JSON string using |
|
|
| Builds a JSON string from a list, including only the named properties. |
|
|
| Serializes an object to XML and returns it as a string. |
Inspecting and validating data
Function | Signature | Returns | Notes |
|
|
| Whether the object belongs to the specified type. Recommended usage is to pass the method and parameter names and leave |
|
|
| The tracking method for an ID. Returns |
See also IsNull and IsEmpty in Working with null and missing values.
Looking up products, SKUs, and alternate IDs
Every function in this section returns a Task and must be awaited, even though none of them carry an Async suffix.
Resolving IDs from a SKU
Function | Signature | Returns | Notes |
|
|
| The iPaaS.com product ID for a SKU. |
|
|
| The variant ID for a SKU. |
|
|
| The parent product ID for a SKU or alternate ID. |
|
|
| A variant's parent ID, from the variant ID. |
Alternate IDs and units
The ...FromStockingUnit variants resolve against the item's stocking unit. The ...FromUnitName variants let you name a specific unit instead.
Function | Signature | Returns |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Summing inventory
By product or variant
Choose between these on two axes: product vs variant, and whether negative inventory counts. The Full prefix means negative values are included.
Function | Negative values | Signatures |
| Excluded |
|
| Included |
|
| Excluded |
|
| Included |
|
All four return Decimal. Omit the location argument to sum across every location, or pass location IDs or location names to scope the sum.
Each has an Async variant - SumInventoryForProductAsync, SumFullInventoryForProductAsync, SumInventoryForVariantAsync, SumFullInventoryForVariantAsync - accepting the same three signatures and returning Task<Decimal>.
From a supplied inventory collection
Function | Signature | Returns |
|
|
|
|
|
|
By location group, with safety stock
These sum by location group name rather than individual locations, and support safety stock. All return Task<Decimal> and must be awaited.
Function | Signature | Use when |
|
| You already have an inventory collection. |
|
| You have a product ID. |
|
| You have a variant ID. |
allowNegative plays the same role as the Full prefix above. safetyType and safetyLevel reserve a buffer quantity, and type selects which quantity is summed.
Kit parents
Function | Signature | Returns |
|
|
|
|
|
|
Kit parent availability is derived from its components, so use these rather than the plain product sums when the product is a kit.
Gift cards
Detecting gift cards on a transaction
Function | Signature | Returns | Notes |
|
|
| Whether the transaction lines include a gift card sale. |
|
|
| Whether the order consists only of gift card sales. |
|
|
| Whether the transaction has gift card sales where the gift card is pending or void. |
|
|
| Identifies gift card sale tickets by payment capture state. |
|
|
| Total price of all gift cards sold on the transaction. |
Reading gift card details
Function | Signature | Returns | Notes |
|
|
| The gift card number for a redeemed gift card. Null checks the ID on the order, validates it exists, then converts it to the number. |
|
|
| Looks up the gift card by the method info's |
|
|
| Whether the order has an associated gift card ticket, and if so its external ID in the specified system. |
Payments and deposits
Function | Signature | Returns | Notes |
|
|
| The payment type for a method name. |
|
|
| The first iPaaS.com payment method name found by case-insensitive search. Use when the external system's naming does not match exactly. |
|
|
| Whether the transaction has any Authorized payments. |
|
|
| Whether a supplied payment list has any captured payments or gift cards. Only evaluated for tickets where |
|
|
| Whether this is an authorization-only deposit ticket, so it can be filtered in the header. |
|
|
| Whether an open deposit ticket is associated with the order. Also confirms the child exists in the external system. |
Discounts
Discounts apply at two levels: the transaction header and individual lines. Pick the function that matches the level you are mapping.
Detecting discounts
Function | Signature | Returns | Level |
|
|
| Header, from the transaction discount collection |
|
|
| Any line, from the transaction lines |
|
|
| One line, from that line's discount collection |
Summing discounts
Function | Signature | Returns | Level |
|
|
| Header, as an amount |
|
|
| All lines, as an amount |
|
|
| One line, as an amount |
|
|
| Header, as a percentage of subtotal, rounded to 3 decimal places |
|
|
| All lines, as a percentage of order subtotal, rounded to 3 decimal places |
Use the percentage variants when the destination system expects a discount rate rather than an amount.
Locations, states, and countries
Locations
Function | Signature | Returns | Notes |
|
|
| The location ID for a location name. |
|
|
| The reverse lookup: location name for a location ID. |
|
|
| Whether a location belongs to a named location group. Useful for routing rules. |
Countries
Function | Signature | Returns | Behaviour when not found |
|
|
| Returns null. |
|
|
| Throws an error. |
|
|
| Returns your default. |
|
|
| The reverse lookup: country name from an ISO code. |
States and provinces
Function | Signature | Returns | Notes |
|
|
| Supports all states and territories of the US and Canada. |
|
|
| The reverse lookup. |
Looking up customers, employees, and transactions
Function | Signature | Returns | Notes |
|
|
| The iPaaS.com customer ID for an email address. |
|
|
| The employee ID for an email address. Async only. |
|
|
| The transaction ID for a transaction number. Async only. |
Translating IDs between systems
These convert between iPaaS.com IDs and external system IDs. See The SpaceportSystemId variable for what to pass as systemId and tableName.
iPaaS.com ID to external ID
Function | Signature | Returns | Notes |
|
|
|
|
|
|
| Pulls the ID for one system out of an external ID collection you already have. No lookup, so prefer this when the collection is available. |
External ID to iPaaS.com ID
Function | Signature | Returns | Notes |
|
|
| Use these. They work for all tables, including those whose IDs are not longs. |
GetSpaceportId and GetSpaceportIdAsync do the same job but only for tables with long IDs, and both are deprecated. See Deprecated functions.
Custom fields and settings
Custom fields
Function | Signature | Returns | Use when |
|
|
| You already have the custom field collection. Returns null if the field does not exist. Registered for both request and response collection types. |
|
|
| You only have a parent ID. This queries iPaaS.com, so it must be awaited. |
Settings
Function | Signature | Returns | Notes |
|
|
| The value for a given setting. |
|
|
| The value of a subscription-level setting. |
Deprecated functions
These are still registered and callable, but should not be used in new mappings. Existing mappings should migrate.
Deprecated | Use instead | Why |
|
| Only works for tables whose IDs are longs. |
|
| Same limitation. |
|
| Replaced by the newer JSON conversion functions. |
| No direct replacement. | Contact support if you rely on this. |
