Overview
The Microsoft Dynamics NAV integration provides a set of ready-made functions you can call when building mappings. They handle common lookups and checks against Microsoft Dynamics NAV and your iPaaS.com data, such as resolving a country code, deciding an order status from shipped quantities, validating a sales order, and reading a customer's posting group, 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 Microsoft Dynamics NAV 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 CountryCodeFromName(SourceCountry).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 withawait; 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 NAV account and your iPaaS.com subscription.
The functions are grouped below by the area of the integration they support.
Sales Orders
IsValidTransaction
What it does: Checks whether a sales order should be treated as valid: its status is Released and its sell-to customer number matches a customer or company in iPaaS.com.
Signature: Task<bool> IsValidTransaction(string status, string sellToCustomerNo, long spaceportSystemId)
How to call it: await IsValidTransaction(status, sellToCustomerNo, spaceportSystemId)
Parameter | Type | Required | Default | Description |
|
| Yes | N/A | The Microsoft Dynamics NAV sales order status. |
|
| Yes | N/A | The Microsoft Dynamics NAV sell-to customer number on the sales order. |
|
| Yes | N/A | The iPaaS.com subscription ID. |
Returns: bool. true when the status is Released and the customer number matches a customer or company in iPaaS.com; otherwise false.
Example: IsValidTransaction("Released", "40000", 14791) returns true when customer number 40000 exists as a customer or company in iPaaS.com.
When to use it: Use this in a mapping filter to process a Microsoft Dynamics NAV sales order only when it is released and its customer is already known to iPaaS.com.
ShippedQuantityPositive
What it does: Chooses an order status based on the shipped quantities of the order's line items. It totals the shipped quantity of item lines and returns one of the status values you supply, depending on whether anything has shipped and whether the shipped total equals the total ordered quantity.
Signature: string ShippedQuantityPositive(string valueIfTrue, string valueIfFalse, string valueIfTotalEqualsQuantity, string checkOrderStatus, string orderStatus, List<SalesOrderLineItem> lineItems)
How to call it: ShippedQuantityPositive(valueIfTrue, valueIfFalse, valueIfTotalEqualsQuantity, checkOrderStatus, orderStatus, lineItems)
Parameter | Type | Required | Default | Description |
|
| Yes | N/A | The status to return when the shipped quantity is positive but does not equal the total ordered quantity. |
|
| Yes | N/A | The status to return when nothing has shipped and the current status is not one of the statuses in |
|
| Yes | N/A | The status to return when the shipped quantity equals the total ordered quantity. |
|
| Yes | N/A | A comma-separated list of order statuses that the current status is checked against. |
|
| Yes | N/A | The current order status. It is returned unchanged when nothing has shipped and it is one of the statuses in |
|
| Yes | N/A | The sales order line items. Only lines of type |
Returns: string. One of the supplied status values, selected by the shipped-quantity check (or the current orderStatus when nothing has shipped and it is in checkOrderStatus).
Example: With shipped item quantities totaling a positive number equal to the ordered quantity, the function returns the valueIfTotalEqualsQuantity status you passed in.
When to use it: Use this to derive a Microsoft Dynamics NAV order status from how much of the order has shipped.
Customers
GetCustomerPostingGroup
What it does: Resolves an iPaaS.com customer or company to its Microsoft Dynamics NAV record and returns that customer's posting group.
Signature: Task<string> GetCustomerPostingGroup(string iPaaSCustomerOrCompanyId)
How to call it: await GetCustomerPostingGroup(iPaaSCustomerOrCompanyId)
Parameter | Type | Required | Default | Description |
|
| Yes | N/A | The iPaaS.com customer or company ID. The customer mapping is checked first, then the company mapping. |
Returns: string. The Microsoft Dynamics NAV customer posting group, or null if no matching mapping is found.
Example: "12345" returns the posting group (for example RETAIL) for the mapped Microsoft Dynamics NAV customer.
When to use it: Use this when a mapping needs the Microsoft Dynamics NAV customer posting group for an iPaaS.com customer or company.
Countries
CountryCodeFromName
What it does: Looks up a country by name in Microsoft Dynamics NAV and returns its country code.
Signature: Task<string> CountryCodeFromName(string CountryName)
How to call it: await CountryCodeFromName(CountryName)
Parameter | Type | Required | Default | Description |
|
| Yes | N/A | The country name to look up in Microsoft Dynamics NAV. |
Returns: string. The Microsoft Dynamics NAV country code, or null if the name is not found.
Example: "USA" returns the Microsoft Dynamics NAV country code, for example US.
When to use it: Use this when a mapping has a country name but a Microsoft Dynamics NAV field needs the country code.
