Skip to main content

Heartland Mapping Functions

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

Overview

The Heartland integration provides ready-made functions you can call when building mappings. They handle common lookups and conversions against your Heartland account and your iPaaS.com data, such as reading a custom field value, resolving items, customers, vendors, payment methods, and shipping methods by ID or name, converting locations, and totaling discounts, taxes, and payments on a transaction, so you do not have to write that logic yourself.

Where you can use these functions

These functions are available anywhere you write a formula for the Heartland 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 GetValueFromCustomField(customFieldObj, textFieldName).

  • 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 Heartland account and your iPaaS.com subscription.

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

Custom fields

GetValueFromCustomField

What it does: Returns the value of a named custom field from a custom fields object, matching the field name after normalizing it so differences in spacing, casing, and punctuation do not matter.

Signature: Task<object> GetValueFromCustomField(object customFieldObj, object textFieldName)

How to call it: await GetValueFromCustomField(customFieldObj, textFieldName)

Parameter

Type

Required

Default

Description

customFieldObj

object

Yes

N/A

The custom fields object to read from (a set of field name and value pairs).

textFieldName

object

Yes

N/A

The name of the custom field whose value you want. Matching ignores case, spacing, and punctuation.

Returns: object. The custom field's value, or null when the field is not found.

Example: for a field named CustomerType, reading CustomerType returns its value (for example B2B).

When to use it: Use it to pull a single custom field value into a destination field, without worrying about the exact formatting of the field name.

GetPropertiesFromCustomFields

What it does: Reads all custom fields from an object and returns them as a dictionary of normalized field names to values. Fields with an empty name or value are skipped.

Signature: Task<Dictionary<string, string>> GetPropertiesFromCustomFields(object customFieldObj)

How to call it: await GetPropertiesFromCustomFields(customFieldObj)

Parameter

Type

Required

Default

Description

customFieldObj

object

Yes

N/A

The object containing the custom fields to extract.

Returns: Dictionary<string, string>. The custom fields keyed by their normalized names; null when the input has no fields.

When to use it: Use it to turn an object's custom fields into a normalized name and value dictionary for mapping.

GetPropertiesFromCustomFieldsComplexFiltering

What it does: Reads an object's custom fields and returns only those that belong to a given group, as a dictionary of normalized field names to values. Fields with an empty name or value are skipped.

Signature: Task<Dictionary<string, string>> GetPropertiesFromCustomFieldsComplexFiltering(object customFieldObj, string groupId)

How to call it: await GetPropertiesFromCustomFieldsComplexFiltering(customFieldObj, groupId)

Parameter

Type

Required

Default

Description

customFieldObj

object

Yes

N/A

The object containing the custom fields to extract.

groupId

string

Yes

N/A

The group identifier; only custom fields that belong to this group are returned.

Returns: Dictionary<string, string>. The matching custom fields keyed by their normalized names; null when the input has no fields.

When to use it: Use it when you only want the custom fields that belong to a specific group.

NormalizeCustomFieldString

What it does: Normalizes a string into a custom-field key by replacing whitespace with single underscores, dropping other non-alphanumeric characters, and lowercasing the result.

Signature: string NormalizeCustomFieldString(string input)

How to call it: NormalizeCustomFieldString(input)

Parameter

Type

Required

Default

Description

input

string

Yes

N/A

The string to normalize into a custom-field key.

Returns: string. The normalized key.

Example: Customer Name Field returns customer_name_field.

When to use it: Use it to produce a consistent custom-field key from a display name.

Products and items

GetItemIdBySku

What it does: Looks up a Heartland item by SKU and returns the ID of the first match.

Signature: Task<long> GetItemIdBySku(object sku)

How to call it: await GetItemIdBySku(sku)

Parameter

Type

Required

Default

Description

sku

object

Yes

N/A

The iPaaS.com product SKU to search for in Heartland.

Returns: long. The Heartland item ID of the first match, or 0 when the SKU is blank or no item matches.

When to use it: Use it to resolve a Heartland item ID from a product SKU.

GetItemBySku

What it does: Looks up a Heartland item by SKU and returns the matching item records.

Signature: Task<object> GetItemBySku(object sku)

How to call it: await GetItemBySku(sku)

Parameter

Type

Required

Default

Description

sku

object

Yes

N/A

The iPaaS.com product SKU to search for in Heartland.

Returns: object. The Heartland item search result containing the matching items.

When to use it: Use it when you need the full Heartland item record for a SKU, not just its ID.

GetGridItemIdBySku

What it does: Looks up a Heartland grid item by SKU and returns the ID of the first match.

Signature: Task<long> GetGridItemIdBySku(object sku)

How to call it: await GetGridItemIdBySku(sku)

Parameter

Type

Required

Default

Description

sku

object

Yes

N/A

The iPaaS.com product SKU to search for as a Heartland grid item.

Returns: long. The Heartland grid item ID of the first match, or 0 when the SKU is blank or no item matches.

When to use it: Use it to resolve a Heartland grid item ID from a product SKU.

GetGridItemBySku

What it does: Looks up a Heartland grid item by SKU and returns the matching grid item records.

Signature: Task<object> GetGridItemBySku(object sku)

How to call it: await GetGridItemBySku(sku)

Parameter

Type

Required

Default

Description

sku

object

Yes

N/A

The iPaaS.com product SKU to search for as a Heartland grid item.

Returns: object. The Heartland grid item search result containing the matching items.

When to use it: Use it when you need the full Heartland grid item record for a SKU.

GetAllItemByGridId

What it does: Retrieves all product variants under a Heartland grid ID.

Signature: Task<GetAllProductVariant> GetAllItemByGridId(object Id)

How to call it: await GetAllItemByGridId(Id)

Parameter

Type

Required

Default

Description

Id

object

Yes

N/A

The Heartland grid ID whose variants you want.

Returns: GetAllProductVariant. The product variants that belong to the grid.

When to use it: Use it to fetch every variant of a Heartland grid product, for inventory or synchronization steps.

Inventory

GetAdjustmentReason

What it does: Looks up a Heartland inventory adjustment reason by name and returns its ID.

Signature: Task<int> GetAdjustmentReason(string reason)

How to call it: await GetAdjustmentReason(reason)

Parameter

Type

Required

Default

Description

reason

string

Yes

N/A

The name of the Heartland inventory adjustment reason to look up (for example Damaged).

Returns: int. The Heartland adjustment reason ID, or 0 when no reason matches.

When to use it: Use it to supply the correct adjustment reason ID when recording an inventory change.

Locations

ConvertLocationToHeartlandId

What it does: Converts an iPaaS.com location ID into the matching Heartland location ID.

Signature: Task<string> ConvertLocationToHeartlandId(string locationId)

How to call it: await ConvertLocationToHeartlandId(locationId)

Parameter

Type

Required

Default

Description

locationId

string

Yes

N/A

The iPaaS.com location ID to convert.

Returns: string. The matching Heartland location ID, or an empty string when no mapping exists.

When to use it: Use it in product and inventory flows to translate an iPaaS.com location into its Heartland location.

Customers

GetCustomerIdByEmail

What it does: Searches Heartland for a customer by email address and returns the ID of the first match.

Signature: Task<string> GetCustomerIdByEmail(object emailAddress)

How to call it: await GetCustomerIdByEmail(emailAddress)

Parameter

Type

Required

Default

Description

emailAddress

object

Yes

N/A

The iPaaS.com customer email address to search for in Heartland.

Returns: string. The Heartland customer ID of the first match, or null when none is found.

When to use it: Use it to resolve a Heartland customer ID from an email address.

GetCustomerByEmail

What it does: Searches Heartland for a customer by email address and returns the matching customer records.

Signature: Task<object> GetCustomerByEmail(object emailAddress)

How to call it: await GetCustomerByEmail(emailAddress)

Parameter

Type

Required

Default

Description

emailAddress

object

Yes

N/A

The iPaaS.com customer email address to search for in Heartland.

Returns: object. The Heartland customer search result containing the matching customers.

When to use it: Use it when you need the full Heartland customer record for an email address.

Vendors

HeartlandVendorNameById

What it does: Looks up a Heartland vendor by ID and returns the vendor's name.

Signature: Task<string?> HeartlandVendorNameById(long vendorId)

How to call it: await HeartlandVendorNameById(vendorId)

Parameter

Type

Required

Default

Description

vendorId

long

Yes

N/A

The Heartland vendor ID to look up.

Returns: string?. The Heartland vendor name, or null when no vendor has that ID.

When to use it: Use it to show a Heartland vendor's name when you only have its ID.

HeartlandVendorIdByName

What it does: Looks up Heartland vendors by name and returns the ID of the last matching vendor.

Signature: Task<long?> HeartlandVendorIdByName(string vendorName)

How to call it: await HeartlandVendorIdByName(vendorName)

Parameter

Type

Required

Default

Description

vendorName

string

Yes

N/A

The Heartland vendor name to look up.

Returns: long?. The ID of the last matching Heartland vendor, or null when none matches.

When to use it: Use it to resolve a Heartland vendor ID from a vendor name.

Payments

GetPaymentMethodNameById

What it does: Resolves a Heartland payment method ID to the payment method's name.

Signature: Task<string> GetPaymentMethodNameById(string PaymentId)

How to call it: await GetPaymentMethodNameById(PaymentId)

Parameter

Type

Required

Default

Description

PaymentId

string

Yes

N/A

The Heartland payment method ID to resolve.

Returns: string. The payment method's name, or null when it cannot be resolved.

When to use it: Use it to show a readable payment method name when you only have its Heartland ID.

PaymentTypeIdByName

What it does: Resolves a payment method name to its Heartland payment method ID.

Signature: Task<long> PaymentTypeIdByName(string PaymentName)

How to call it: await PaymentTypeIdByName(PaymentName)

Parameter

Type

Required

Default

Description

PaymentName

string

Yes

N/A

The iPaaS.com payment method name to resolve.

Returns: long. The Heartland payment method ID, or 0 when it cannot be resolved.

When to use it: Use it to supply a Heartland payment method ID when you only have the method's name.

GetPaymentMethodDescriptionById

What it does: Resolves a Heartland payment method ID to the payment method's description.

Signature: Task<string> GetPaymentMethodDescriptionById(string PaymentId)

How to call it: await GetPaymentMethodDescriptionById(PaymentId)

Parameter

Type

Required

Default

Description

PaymentId

string

Yes

N/A

The Heartland payment method ID to resolve.

Returns: string. The payment method's description, or null when it cannot be resolved.

When to use it: Use it to show a payment method's description when you only have its Heartland ID.

PaymentMethodType

What it does: Standardizes a raw payment method string to one of the recognized payment method names, or returns null when it is not recognized.

Signature: string PaymentMethodType(string input)

How to call it: PaymentMethodType(input)

Parameter

Type

Required

Default

Description

input

string

Yes

N/A

The raw payment method string to standardize.

Returns: string. The standardized payment method name (Cash, Check, Gift Card, Credit Card, or Debit Card), or null when the input is empty or unrecognized.

Example: cash returns Cash; GiftCard returns Gift Card.

When to use it: Use it to normalize inconsistent payment method text into a standard name.

GetAllPaymentsAmount

What it does: Sums the amounts of all payments in a transaction, treating a missing amount as zero.

Signature: double GetAllPaymentsAmount(List<TransactionPayment> transactionPayment)

How to call it: GetAllPaymentsAmount(transactionPayment)

Parameter

Type

Required

Default

Description

transactionPayment

List<TransactionPayment>

Yes

N/A

The transaction's payments to sum.

Returns: double. The total of all payment amounts.

When to use it: Use it to compute the total amount paid across a transaction's payments.

Shipping

HeartlandShippingMethodIdByName

What it does: Resolves a shipping method name to its Heartland shipping method ID.

Signature: Task<long> HeartlandShippingMethodIdByName(string ShippingMethodName)

How to call it: await HeartlandShippingMethodIdByName(ShippingMethodName)

Parameter

Type

Required

Default

Description

ShippingMethodName

string

Yes

N/A

The iPaaS.com shipping method name to resolve.

Returns: long. The Heartland shipping method ID, or 0 when it cannot be resolved.

When to use it: Use it to supply a Heartland shipping method ID when you only have the method's name.

GetShippingMethod

What it does: Resolves a shipping method ID to the shipping method's name.

Signature: Task<object> GetShippingMethod(object shippingMethodId)

How to call it: await GetShippingMethod(shippingMethodId)

Parameter

Type

Required

Default

Description

shippingMethodId

object

Yes

N/A

The Heartland shipping method ID to resolve.

Returns: object. The shipping method's name, or null when it cannot be resolved.

When to use it: Use it to show a readable shipping method name when you only have its ID.

Transactions and lines

GetDiscountAmount

What it does: Sums the discount applied across a transaction's lines, computed as the price before discounts minus the final price for each line.

Signature: object GetDiscountAmount(object transactionLineObj)

How to call it: GetDiscountAmount(transactionLineObj)

Parameter

Type

Required

Default

Description

transactionLineObj

object

Yes

N/A

The transaction's lines to total.

Returns: object. The total discount amount, or 0 when there are no lines.

When to use it: Use it to compute the total discount on a transaction.

GetTaxAmount

What it does: Sums the tax values across a transaction's tax records.

Signature: object GetTaxAmount(object transactionTaxObj)

How to call it: GetTaxAmount(transactionTaxObj)

Parameter

Type

Required

Default

Description

transactionTaxObj

object

Yes

N/A

The transaction's tax records to total.

Returns: object. The total tax amount, or 0 when there are no tax records.

When to use it: Use it to compute the total tax on a transaction.

RequiresDepositTicket

What it does: Returns whether a deposit ticket is required, which is true when the transaction includes at least one sold, non-gift-card product.

Signature: bool RequiresDepositTicket(List<TransactionLine> products_Data)

How to call it: RequiresDepositTicket(products_Data)

Parameter

Type

Required

Default

Description

products_Data

List<TransactionLine>

Yes

N/A

The transaction's lines to evaluate.

Returns: bool. True when at least one non-gift-card product was sold, otherwise false.

When to use it: Use it to decide whether a deposit ticket should be generated for a transaction.

ProductSoldCount

What it does: Totals the quantity of sold, non-gift-card products across a transaction's lines.

Signature: double ProductSoldCount(List<TransactionLine> products_Data)

How to call it: ProductSoldCount(products_Data)

Parameter

Type

Required

Default

Description

products_Data

List<TransactionLine>

Yes

N/A

The transaction's lines to total.

Returns: double. The total quantity of non-gift-card products sold.

When to use it: Use it to count how many products (excluding gift cards) were sold in a transaction.

GiftCardSoldCount

What it does: Counts the transaction lines that are gift cards.

Signature: int GiftCardSoldCount(List<TransactionLine> products_Data)

How to call it: GiftCardSoldCount(products_Data)

Parameter

Type

Required

Default

Description

products_Data

List<TransactionLine>

Yes

N/A

The transaction's lines to evaluate.

Returns: int. The number of gift card lines (not the total quantity of gift cards).

When to use it: Use it to count how many gift card lines are in a transaction.

GiftCardSoldAmount

What it does: Sums the monetary value of the gift card lines in a transaction.

Signature: double GiftCardSoldAmount(List<TransactionLine> products_Data)

How to call it: GiftCardSoldAmount(products_Data)

Parameter

Type

Required

Default

Description

products_Data

List<TransactionLine>

Yes

N/A

The transaction's lines to total.

Returns: double. The total value of the gift card lines.

When to use it: Use it to compute total gift card sales in a transaction.

HeartlandLineValueByType

What it does: Returns the value of the first transaction line that matches a given line type, when that value is greater than zero.

Signature: double? HeartlandLineValueByType(List<TransactionLine> transactionLine, string lineType)

How to call it: HeartlandLineValueByType(transactionLine, lineType)

Parameter

Type

Required

Default

Description

transactionLine

List<TransactionLine>

Yes

N/A

The transaction's lines to search.

lineType

string

Yes

N/A

The line type to match. Matching is case-sensitive (for example taxline, discountline).

Returns: double?. The value of the first matching line when it is greater than zero, otherwise 0.

When to use it: Use it to pull a specific line's value (such as a tax or shipping line) out of a transaction.

Related Documents

Did this answer your question?