Skip to main content

Microsoft Dynamics 365 Business Central Mapping Functions

Reference for the Microsoft Dynamics 365 Business Central-specific functions you can use in Dynamic Formula mappings and mapping collection filters.

Overview

The Microsoft Dynamics 365 Business Central integration provides a set of ready-made functions you can call when building mappings. They handle common lookups and conversions for Business Central, such as finding a customer, location, payment journal, or country code by a value you already have, building a formatted sales price string, reading a value from a record's custom fields, or resolving IDs between Business Central and iPaaS.com, so you don't have to write that logic yourself.

Where you can use these functions

These functions are available anywhere you write a formula for the Microsoft Dynamics 365 Business Central 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 GetCustomerNoById(CustomerId).

  • 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 Microsoft Dynamics 365 Business Central account and your iPaaS.com subscription.

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

Customers

Use these when looking up a Business Central customer or reading customer details during mapping.

GetCustomerNoById

What it does: Returns a Business Central customer number for a given Business Central customer ID. Returns nothing if the customer is not found.

Signature: Task<string> GetCustomerNoById(string CustomerId)

How to call it: await GetCustomerNoById(CustomerId)

Parameter

Type

Required

Default

Description

CustomerId

string

Yes

N/A

The Business Central customer ID that is stored on the sales order in iPaaS.com as an external ID.

Returns: string. The Business Central customer number, or nothing if the customer is not found.

Example: await GetCustomerNoById("c5f40f4aa93c45279cb9b6bed7c1a64a") returns the customer number, for example "SalesOrder1".

When to use it: When mapping a sales order from iPaaS.com to Business Central and you need the customer's number from its Business Central ID.

GetCustomerNameById

What it does: Returns a Business Central customer name for a given Business Central customer ID. Returns nothing if the customer is not found.

Signature: Task<string> GetCustomerNameById(string CustomerId)

How to call it: await GetCustomerNameById(CustomerId)

Parameter

Type

Required

Default

Description

CustomerId

string

Yes

N/A

The Business Central customer ID that is stored on the sales order in iPaaS.com.

Returns: string. The Business Central customer name, or nothing if the customer is not found.

Example: await GetCustomerNameById("a18ef280-68c3-ef11-8a6d-0022482e7f3c") returns the customer's name, for example "Thomas".

When to use it: When adding a billing address to a Business Central sales order and you need the customer's name (for example to map to the bill-to name) from its Business Central customer ID.

GetCustomerShippingAgentCodeById

What it does: Returns a Business Central customer's shipping agent code for a given Business Central customer ID. Returns nothing if the customer is not found.

Signature: Task<string> GetCustomerShippingAgentCodeById(string CustomerId)

How to call it: await GetCustomerShippingAgentCodeById(CustomerId)

Parameter

Type

Required

Default

Description

CustomerId

string

Yes

N/A

The Business Central customer ID that is stored on the sales order in iPaaS.com as an external ID.

Returns: string. The Business Central customer's shipping agent code, or nothing if the customer is not found.

Example: await GetCustomerShippingAgentCodeById("c5f40f4aa93c45279cb9b6bed7c1a64a") returns the shipping agent code, for example "DHL".

When to use it: When mapping a sales order from iPaaS.com to Business Central and you need the customer's default shipping agent code.

GetCustomerShippingAgentServiceCodeById

What it does: Returns a Business Central customer's shipping agent service code for a given Business Central customer ID. Returns nothing if the customer is not found.

Signature: Task<string> GetCustomerShippingAgentServiceCodeById(string CustomerId)

How to call it: await GetCustomerShippingAgentServiceCodeById(CustomerId)

Parameter

Type

Required

Default

Description

CustomerId

string

Yes

N/A

The Business Central customer ID that is stored on the sales order in iPaaS.com as an external ID.

Returns: string. The Business Central customer's shipping agent service code, or nothing if the customer is not found.

Example: await GetCustomerShippingAgentServiceCodeById("c5f40f4aa93c45279cb9b6bed7c1a64a") returns the shipping agent service code, for example "EXPRESS".

When to use it: When mapping a sales order from iPaaS.com to Business Central and you need the customer's default shipping agent service code.

GetDynamicsCodeFromCategories

What it does: Takes an iPaaS.com customer or company category list, finds the category that is mapped to Business Central, and returns the matching Business Central customer price group code. Returns an empty string if no category is mapped.

Signature: Task<string> GetDynamicsCodeFromCategories(object categories)

How to call it: await GetDynamicsCodeFromCategories(categories)

Parameter

Type

Required

Default

Description

categories

object

Yes

N/A

The iPaaS.com customer or company category data assigned to the record.

Returns: string. The Business Central customer price group code for the mapped category, or an empty string if none is mapped.

Example: await GetDynamicsCodeFromCategories(categories) returns the Business Central customer price group code for the mapped category, for example "RETAIL".

When to use it: When mapping an iPaaS.com customer or company category to its Business Central customer price group code.

Companies

Use this to resolve the external ID a connected system uses for an iPaaS.com customer company.

GetCompanyExternalId

What it does: Returns the external ID that a connected system uses for an iPaaS.com customer company, by matching the company's external IDs to the given iPaaS.com system ID. Returns nothing if no match is found.

Signature: Task<string> GetCompanyExternalId(object iPaaSCustomerCompanyInternalId, object spaceportSystemId)

How to call it: await GetCompanyExternalId(iPaaSCustomerCompanyInternalId, spaceportSystemId)

Parameter

Type

Required

Default

Description

iPaaSCustomerCompanyInternalId

object

Yes

N/A

The iPaaS.com customer company record's internal ID.

spaceportSystemId

object

Yes

N/A

The iPaaS.com system internal ID whose external ID you want.

Returns: string. The external ID that the given system uses for the company, or nothing if no match is found.

Example: await GetCompanyExternalId(12345, 678) returns the external ID that system 678 uses for iPaaS.com company 12345.

When to use it: When you need the external ID a specific connected system uses for an iPaaS.com customer company.

Sales Orders and Payments

Use these when preparing a Business Central sales order, including its country, shipping method, and payment references.

CountryCodeFromName

What it does: Looks up a country in Business Central by its name and returns the Business Central country code. Returns nothing if the country is not found.

Signature: Task<string> CountryCodeFromName(string CountryName)

How to call it: await CountryCodeFromName(CountryName)

Parameter

Type

Required

Default

Description

CountryName

string

Yes

N/A

The iPaaS.com country name to look up in Business Central (for example "USA").

Returns: string. The Business Central country code, or nothing if the country is not found.

Example: await CountryCodeFromName("USA") returns the country code, for example "US".

When to use it: When mapping an address country from iPaaS.com to its Business Central country code.

IsShippingMethodExistsInIPaaS

What it does: Checks whether a shipping method with the given name exists in iPaaS.com. Returns true when a match is found and false otherwise.

Signature: Task<bool> IsShippingMethodExistsInIPaaS(object name)

How to call it: await IsShippingMethodExistsInIPaaS(name)

Parameter

Type

Required

Default

Description

name

object

Yes

N/A

The Business Central shipping method name to look up in iPaaS.com.

Returns: bool. true if a matching shipping method exists in iPaaS.com; otherwise false.

Example: await IsShippingMethodExistsInIPaaS("Standard Ground") returns true when a matching shipping method exists in iPaaS.com.

When to use it: In a mapping filter, to allow a transfer only when the Business Central shipping method already exists in iPaaS.com (for example before transferring tracking information).

GetCustomerPaymentJournalIdByNameAsync

What it does: Looks up a Business Central customer payment journal by name and returns its ID. The name must match exactly. Returns nothing if no journal matches.

Signature: Task<string?> GetCustomerPaymentJournalIdByNameAsync(string name)

How to call it: await GetCustomerPaymentJournalIdByNameAsync(name)

Parameter

Type

Required

Default

Description

name

string

Yes

N/A

The customer payment journal name to match in Business Central. The match is exact.

Returns: string?. The Business Central customer payment journal ID, or nothing if no journal matches.

Example: await GetCustomerPaymentJournalIdByNameAsync("GENERAL") returns the ID of the "GENERAL" customer payment journal.

When to use it: When creating or updating a Business Central customer payment and you have the journal's name but need its ID.

GetPaymentTermsIdByNameAsync

What it does: Looks up a Business Central payment term by name and returns its ID. The name must match exactly. Returns nothing if no term matches.

Signature: Task<string?> GetPaymentTermsIdByNameAsync(string name)

How to call it: await GetPaymentTermsIdByNameAsync(name)

Parameter

Type

Required

Default

Description

name

string

Yes

N/A

The payment term name to match in Business Central. The match is exact.

Returns: string?. The Business Central payment term ID, or nothing if no term matches.

Example: await GetPaymentTermsIdByNameAsync("COD") returns the ID of the "COD" payment term.

When to use it: When creating or updating a Business Central transaction that references a payment term and you have the term's name but need its ID.

Products and Sales Prices

Use this when building a Business Central sales price string for a product.

GetFormattedStringFromSalesPricesBySalesCode

What it does: Builds a delimited string of Business Central sales price details for a given sales code. It keeps the most recent entry per end date, optionally drops expired entries, and joins the results using the configured field separator and record delimiter. Returns nothing if the sales code is not found.

Signature: string GetFormattedStringFromSalesPricesBySalesCode(object salesPricesObj, string salesCode)

How to call it: GetFormattedStringFromSalesPricesBySalesCode(salesPricesObj, salesCode)

Parameter

Type

Required

Default

Description

salesPricesObj

object

Yes

N/A

The Business Central sales price data to search (a list of sales price records).

salesCode

string

Yes

N/A

The Business Central sales code used to select matching sales price records.

Returns: string. A delimited string of the matching sales price details, or nothing if the sales code is not found.

Example: For a sales code with one matching price, GetFormattedStringFromSalesPricesBySalesCode(salesPrices, "SC123") returns a value such as "25.99|Customer|CUST001|1000|Wireless Mouse|PCS|5|2024-01-01|2024-12-31".

When to use it: When mapping Business Central sales prices for a product into a single formatted value. This function requires the Sales Price Field Separator and Sales Price Record Delimiter presets to be set; without them, the transfer raises an error.

Locations and Inventory

Use these when converting Business Central location values during inventory mapping.

ConvertLocationCodeToLocationId

What it does: Looks up a Business Central location by its code and returns the Business Central location ID. Returns nothing if the location is not found.

Signature: Task<string> ConvertLocationCodeToLocationId(string Location)

How to call it: await ConvertLocationCodeToLocationId(Location)

Parameter

Type

Required

Default

Description

Location

string

Yes

N/A

The Business Central location code.

Returns: string. The Business Central location ID, or nothing if the location is not found.

Example: await ConvertLocationCodeToLocationId("EAST") returns the Business Central location ID for the "EAST" location.

When to use it: When mapping a Business Central location code to its Business Central location ID.

ConvertLocationIdToiPaaSId

What it does: Converts a Business Central location ID into the matching iPaaS.com location ID by looking up the location's external ID mapping. Returns nothing if no match is found.

Signature: Task<string> ConvertLocationIdToiPaaSId(string LocationId)

How to call it: await ConvertLocationIdToiPaaSId(LocationId)

Parameter

Type

Required

Default

Description

LocationId

string

Yes

N/A

The Business Central location ID assigned to the product.

Returns: string. The matching iPaaS.com location ID, or nothing if no match is found.

Example: await ConvertLocationIdToiPaaSId("c5f40f4aa93c45279cb9b6bed7c1a64a") returns the iPaaS.com location ID, for example "23".

When to use it: When transferring inventory into iPaaS.com and you need the iPaaS.com location ID for a Business Central location.

Custom Fields

Use this to read a value from a Business Central record's custom fields.

GetValueFromCustomField

What it does: Reads the value of a named custom field from a Business Central custom field object. Returns nothing if the field is not present or has no value.

Signature: object GetValueFromCustomField(object customFieldObj, object textFieldName)

How to call it: GetValueFromCustomField(customFieldObj, textFieldName)

Parameter

Type

Required

Default

Description

customFieldObj

object

Yes

N/A

The Business Central custom field object (for example a record's additional properties) to read from.

textFieldName

object

Yes

N/A

The name of the Business Central custom field to retrieve.

Returns: object. The custom field's value, or nothing if the field is not present or has no value.

Example: For a custom field object containing Active_Web_User set to "Thomas", GetValueFromCustomField(customFieldObj, "Active_Web_User") returns "Thomas".

When to use it: When mapping a value out of a Business Central record's custom fields (for example a status held in the record's additional properties).

Related Documents

Did this answer your question?