Overview
The Avalara AvaTax integration provides a set of ready-made functions you can call when building mappings. They handle common conversions and lookups for Avalara AvaTax, such as building a state or country model for an address, looking up a certificate exposure zone or exemption reason, or reading a value from your source data, 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 Avalara AvaTax 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:
CreateStateModelFromName(name).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.Optional parameters are marked in the parameter table, along with the value used when you omit them.
Each function runs at sync time, against the data in your connected Avalara AvaTax account and your iPaaS.com subscription.
The functions are grouped below by the area of the integration they support.
Addresses: State and Country
Use these when preparing the state and country values on an address for Avalara AvaTax. The State and Country values Avalara expects are model objects; these builders create them from an ID, an ISO code, or a name.
CreateStateModel
What it does: Builds an Avalara AvaTax State model from a state value, selecting the form automatically: a two-character value is treated as the state initials, and any longer value is treated as the state name.
Signature: State CreateStateModel(string state)
How to call it: CreateStateModel(state)
Parameter | Type | Required | Default | Description |
state |
| Yes | N/A | The iPaaS.com state value to convert, either the two-letter initials (for example |
Returns: State. An Avalara AvaTax state model built from the initials or the name, or nothing when no state value is supplied.
Example: CreateStateModel("CA") builds a state model from the initials "CA"; CreateStateModel("California") builds one from the name.
When to use it: When your iPaaS.com data may hold either the state initials or the full state name and you want the function to pick the correct form.
CreateStateModelFromId
What it does: Builds an Avalara AvaTax State model identified by its numeric state ID.
Signature: State CreateStateModelFromId(int id)
How to call it: CreateStateModelFromId(id)
Parameter | Type | Required | Default | Description |
id |
| Yes | N/A | The state ID to set on the Avalara AvaTax state model. |
Returns: State. An Avalara AvaTax state model with its ID set to the supplied value.
Example: CreateStateModelFromId(5) builds a state model with ID 5.
When to use it: When your iPaaS.com data supplies the numeric state ID.
CreateStateModelFromInitials
What it does: Builds an Avalara AvaTax State model from a state's two-letter initials.
Signature: State CreateStateModelFromInitials(string initials)
How to call it: CreateStateModelFromInitials(initials)
Parameter | Type | Required | Default | Description |
initials |
| Yes | N/A | The two-letter state initials from your iPaaS.com data (for example |
Returns: State. An Avalara AvaTax state model with its initials set to the supplied value.
Example: CreateStateModelFromInitials("CA") builds a state model with the initials "CA".
When to use it: When your iPaaS.com data supplies the two-letter state initials.
CreateStateModelFromName
What it does: Builds an Avalara AvaTax State model from a state's full name.
Signature: State CreateStateModelFromName(string name)
How to call it: CreateStateModelFromName(name)
Parameter | Type | Required | Default | Description |
name |
| Yes | N/A | The full state name from your iPaaS.com data (for example |
Returns: State. An Avalara AvaTax state model with its name set to the supplied value.
Example: CreateStateModelFromName("California") builds a state model with the name "California".
When to use it: When your iPaaS.com data supplies the full state name.
CreateCountryModel
What it does: Builds an Avalara AvaTax Country model from a country value, selecting the form automatically: a two-character value is treated as the country initials, a three-character value as the country abbreviation, and any longer value as the country name.
Signature: Country CreateCountryModel(string country)
How to call it: CreateCountryModel(country)
Parameter | Type | Required | Default | Description |
country |
| Yes | N/A | The iPaaS.com country value to convert: the two-letter initials ( |
Returns: Country. An Avalara AvaTax country model built from the initials, abbreviation, or name, or nothing when no country value is supplied.
Example: CreateCountryModel("US") builds a country model from the initials "US".
When to use it: When your iPaaS.com data may hold the country in any of these forms and you want the function to pick the correct one.
CreateCountryModelFromId
What it does: Builds an Avalara AvaTax Country model identified by its numeric country ID.
Signature: Country CreateCountryModelFromId(int id)
How to call it: CreateCountryModelFromId(id)
Parameter | Type | Required | Default | Description |
id |
| Yes | N/A | The country ID to set on the Avalara AvaTax country model. |
Returns: Country. An Avalara AvaTax country model with its ID set to the supplied value.
Example: CreateCountryModelFromId(1) builds a country model with ID 1.
When to use it: When your iPaaS.com data supplies the numeric country ID.
CreateCountryModelFromInitials
What it does: Builds an Avalara AvaTax Country model from a country's two-letter initials.
Signature: Country CreateCountryModelFromInitials(string initials)
How to call it: CreateCountryModelFromInitials(initials)
Parameter | Type | Required | Default | Description |
initials |
| Yes | N/A | The two-letter country initials from your iPaaS.com data (for example |
Returns: Country. An Avalara AvaTax country model with its initials set to the supplied value.
Example: CreateCountryModelFromInitials("US") builds a country model with the initials "US".
When to use it: When your iPaaS.com data supplies the two-letter country initials.
CreateCountryModelFromAbbreviation
What it does: Builds an Avalara AvaTax Country model from a country's three-letter abbreviation.
Signature: Country CreateCountryModelFromAbbreviation(string abbreviation)
How to call it: CreateCountryModelFromAbbreviation(abbreviation)
Parameter | Type | Required | Default | Description |
abbreviation |
| Yes | N/A | The three-letter country abbreviation from your iPaaS.com data (for example |
Returns: Country. An Avalara AvaTax country model with its abbreviation set to the supplied value.
Example: CreateCountryModelFromAbbreviation("USA") builds a country model with the abbreviation "USA".
When to use it: When your iPaaS.com data supplies the three-letter country abbreviation.
CreateCountryModelFromName
What it does: Builds an Avalara AvaTax Country model from a country's full name.
Signature: Country CreateCountryModelFromName(string name)
How to call it: CreateCountryModelFromName(name)
Parameter | Type | Required | Default | Description |
name |
| Yes | N/A | The full country name from your iPaaS.com data (for example |
Returns: Country. An Avalara AvaTax country model with its name set to the supplied value.
Example: CreateCountryModelFromName("United States") builds a country model with the name "United States".
When to use it: When your iPaaS.com data supplies the full country name.
GetShortCodeByCountryName
What it does: Returns the two-letter ISO code for a country name. If the name is not found, the original value is returned unchanged; if the input is empty, nothing is returned.
Signature: string GetShortCodeByCountryName(string Country)
How to call it: GetShortCodeByCountryName(Country)
Parameter | Type | Required | Default | Description |
Country |
| Yes | N/A | The country name to convert to a two-letter ISO code (for example |
Returns: string. The two-letter ISO code, or the original input if no match is found, or nothing if the input is empty.
Example: GetShortCodeByCountryName("United States") returns "US".
When to use it: When mapping a country name to its two-letter ISO code.
Certificates
Use these when mapping exemption certificate data to Avalara AvaTax.
GetCertificateExposureZoneNameAsync
What it does: Looks up an Avalara certificate exposure zone by name or region and returns the matching zone name. Returns nothing if no zone matches. The match is not case-sensitive.
Signature: Task<string> GetCertificateExposureZoneNameAsync(string value)
How to call it: await GetCertificateExposureZoneNameAsync(value)
Parameter | Type | Required | Default | Description |
value |
| Yes | N/A | The exposure zone name or region to look up in Avalara (for example |
Returns: string. The matching Avalara exposure zone name, or nothing if no zone matches.
Example: await GetCertificateExposureZoneNameAsync("EU") returns "EU" when a matching zone exists.
When to use it: When mapping an exemption certificate's exposure zone to Avalara AvaTax.
GetCertificateExemptionReasonNameAsync
What it does: Looks up an Avalara certificate exemption reason by name and returns the matching reason name. Returns nothing if no reason matches. The match is not case-sensitive.
Signature: Task<string> GetCertificateExemptionReasonNameAsync(string value)
How to call it: await GetCertificateExemptionReasonNameAsync(value)
Parameter | Type | Required | Default | Description |
value |
| Yes | N/A | The exemption reason name to look up in Avalara (for example |
Returns: string. The matching Avalara exemption reason name, or nothing if no reason matches.
Example: await GetCertificateExemptionReasonNameAsync("RESALE") returns "RESALE" when a matching reason exists.
When to use it: When mapping an exemption certificate's exemption reason to Avalara AvaTax.
Customer Data
Use these when reading values out of your source data during mapping.
GetValueFromList
What it does: Reads a named property (for example City or PostalCode) from the first address in a customer address list, and returns it as text. Optionally reads from the billing address. Returns an empty string if the property is not present.
Signature: Task<string> GetValueFromList(object addressListData, string propertyName, bool isBilling = false, bool boolValue = false)
How to call it: await GetValueFromList(addressListData, propertyName)
Parameter | Type | Required | Default | Description |
addressListData |
| Yes | N/A | The customer address list from your iPaaS.com source data (for example an iPaaS.com order's addresses). |
propertyName |
| Yes | N/A | The property name to read (for example |
isBilling |
| No |
| When |
boolValue |
| No |
| A flag that influences the internal selection logic. |
Returns: string. The requested property value from the first matching address, or an empty string if the property is not present.
Example: await GetValueFromList(addressListData, "City") returns the City value of the first address.
When to use it: When mapping a value from a customer address (such as city or postal code) into an Avalara AvaTax field.
GetPropertyValue
What it does: Returns the value of a named property from an object. Returns nothing if the object has no property with that name.
Signature: object GetPropertyValue(object obj, string propertyName)
How to call it: GetPropertyValue(obj, propertyName)
Parameter | Type | Required | Default | Description |
obj |
| Yes | N/A | The object to read the property from. |
propertyName |
| Yes | N/A | The name of the property to read (for example |
Returns: object. The property's value, or nothing if the object has no property with that name.
Example: GetPropertyValue(address, "City") returns the City value of the address object.
When to use it: When you need to read a single named property out of an object during mapping.
