Skip to main content

NetSuite Add Cash Sale FROM iPaaS

Transfer iPaaS cash transactions to NetSuite as sales orders

Updated today

Overview

When a transaction is created in iPaaS.com that qualifies as a cash sale, meaning it has at least one payment with a description that does not contain "House Account," a non-refunded status, and a non-negative total, it is transferred to NetSuite as a Cash Sale. This mapping collection handles the creation of Cash Sales, including header-level details, address information, gift redemption, line items, and gift card line items.

This mapping works alongside two related collections that handle different transaction types from the same iPaaS.com source: NetSuite Sales Order Add From iPaaS.com (for "House Account" payments) and NetSuite Sales Order Cancel From iPaaS.com (for cancellations). The mapping filter on each collection determines which transactions are routed where.

NetSuite calculates its own tax amounts based on the customer, item, and shipping method configuration. Tax amounts cannot be set directly from iPaaS.com using the API. Template mappings include the iPaaS.com tax amount in the order memo, and the tax amount may also be uploaded to a transaction custom field. Consult with your NetSuite implementation team to implement overrides of the NetSuite-calculated tax amount after the Cash Sale has been created.

Before You Begin

Ensure the following prerequisites are in place before configuring this integration.

iPaaS.com Requirements

  • The transaction must have a Payments collection with at least one payment

  • At least one payment must have a non-empty Description that does not contain "House Account".

  • Transaction status must not be "Refunded" or "Partially Refunded".

  • The transaction total must be greater than or equal to 0.

  • Line item SKUs should be linked to existing NetSuite items.

  • For gift card line items, the iPaaS.com product SKU must exist in NetSuite as a Gift Certificate item.

  • For gift card line items, the iPaaS.com product SKU quantity must not be greater than 1.

  • For gift redemption (Transaction Payment in iPaaS.com), the iPaaS.com gift card Id must exist in iPaaS.com as gift card.

NetSuite Requirements

  • Customer records must exist in NetSuite (matched by External ID or email address).

  • Items referenced in line mappings must exist in NetSuite.

  • Order status values must be configured in the lookup translation table

  • A valid Location must be configured in NetSuite, and its name must be entered in the Location_Id dynamic formula.

  • A valid Subsidiary must be configured in NetSuite, and its name entered in the Subsidiary_Id dynamic formula.

  • An open Accounting Period must exist for the transaction date.

  • If using tax overrides, the required custom fields must be created (see Custom Fields Support).

  • Shipping methods must be configured to match iPaaS.com shipping method names.

  • For gift redemption (Transaction Payment in iPaaS.com), the iPaaS.com gift card Id must exist in NetSuite as a gift certificate.

ID Format

When manually transferring a Transaction from iPaaS.com, enter the valid iPaaS.com Transaction (internal ID) into the input field on the iPaaS.com manual sync page.

  • External ID Format: The NetSuite Cash Sale internal ID will be saved as the external ID in iPaaS.com.

Mapping Collection Status

  • Status: Enabled

  • Trigger Events: Create (Add)

Supported Child Collections

This flow uses two child collections to create the complete Cash Sale record in NetSuite:

Data Requirements

The following fields are required for successful Cash Sale creation.

Mandatory Header Fields

  • Entity_Id (NetSuite Customer ID)

  • OrderStatus_RefName (via lookup translation)

  • CreateTransactionAs (static: "cash sale")

  • Location_Id (resolved by location name)

  • Subsidiary_Id (resolved by subsidiary name)

  • TransactionDate (validated against accounting period)

Recommended Header Fields

  • Memo

  • Email

  • Total

  • Subtotal

  • OtherRefNum (Transaction Number)

  • ShipMethod_RefName

  • ShippingCost/AltShippingCost

Mandatory Line Fields

  • Item_Id (NetSuite Item ID, resolved by SKU)

  • Quantity

  • Amount

Mandatory Gift Card Line Fields

  • Item_Id (NetSuite Gift Certificate Item ID, resolved by SKU)

  • Quantity

  • Amount

  • GiftCertificateFrom

  • GiftCertificateMessage

  • GiftCertificateRecipientEmail

  • GiftCertificateRecipientName

Mandatory Gift Redemption Fields

  • PaymentMethodType

  • GiftCertRedemption_AuthCode_Id

  • GiftCertRedemption_AuthCodeApplied

System Caveats

iPaaS.com Caveats

  • Transaction Qualification: The Cash Sale mapping filter checks for the presence of payments with descriptions that do not contain "House Account." This is the inverse of the Sales Order filter — transactions where all payment descriptions containing "House Account" are routed to the Sales Order mapping instead. The filter also excludes refunded and partially refunded transactions and requires a non-negative total.

  • Customer Resolution: The Entity_Id mapping uses a two-step fallback to resolve the NetSuite Customer ID. It first attempts to look up the external ID using the CustomerId, then falls back to a lookup by email address. If neither resolves, the transfer will fail with an API exception.

  • Gift Card Existence Validation: Before creating a NetSuite cash sale order with gift certificate redemption, the mapping first checks if the gift card exists in iPaaS.com using the provided GiftCardId.

    If the GiftCardId does not exist in iPaaS.com, the mapping then searches NetSuite for a gift certificate using the gift card number (giftCertCode).

NetSuite Caveats

  • Tax Calculation: NetSuite calculates tax amounts independently based on customer, item, and shipping configuration. iPaaS.com tax amounts are included in the order memo for reference and may be uploaded to custom fields, but they do not override NetSuite's calculated tax. Consult your NetSuite implementation team if tax overrides are required.

  • Location and Subsidiary: The Location_Id and Subsidiary_Id formulas contain hardcoded names that must be updated to match your NetSuite configuration. If the specified name does not exist in NetSuite, the transfer will fail with an exception.

  • Accounting Period: NetSuite requires that the transaction date fall within an open accounting period. If the period is closed or the transaction date does not fall within an allowable range, NetSuite will reject the Cash Sale. The TransactionDate mapping validates this using the CheckPostingGroupByTransactionDate function.

  • Tax Items on Customers: Tax items assigned to customers may apply additional tax amounts for shipping or handling. When iPaaS.com creates a new customer, it will not have these tax items assigned by default, but they may exist on previously created customers. If a tax item charges tax on shipping, NetSuite will add this amount automatically. iPaaS.com tax totals are included in the memo for comparison.

  • Gift Certificate Requirement: A corresponding NetSuite gift certificate must exist for any applied gift card.

    If no gift certificate exists in NetSuite, the mapping will fail, even if the gift card exists in iPaaS.com.

Integration Caveats

  • SKU Validation on Lines: Line item filters validate that each SKU exists in NetSuite before including the line. If a SKU is not linked to a NetSuite item, the filter throws an exception and the line is not transferred.

  • Commented-Out Code: Several dynamic formulas in this template contain commented-out example code for tax code mapping. These are provided as starting points and must be updated to match your specific NetSuite configuration before uncommenting.

  • Hardcoded Values: The Location_Id, Subsidiary_Id, and TransactionDate (accounting period ID) formulas contain hardcoded values that must be updated for your environment.

  • Quantity Validation on Gift Card Lines The line item filter validates that the quantity must not be greater than 1. If the quantity exceeds 1, an error is thrown. This ensures that only SKUs with a quantity of 1, configured as NetSuite Gift Certificate items, are included.

Custom Fields Support

This integration references several NetSuite custom fields for tax override functionality. These fields must be created in NetSuite before they can be populated.

Order-Level Tax Custom Fields

If using order-level tax collection in NetSuite, create the following transaction body custom fields:

  • custbody_otg_ipaas_tax_code: NetSuite Cash Sale Header Custom Tax Code

  • custbody_otg_ipaas_tax_rate: NetSuite Cash Sale Header Custom Tax Percent

Line-Level Tax Custom Fields

If using line-item-level tax collection in NetSuite, create the following transaction column custom fields:

  • custcol_otg_ipaas_tax_code: NetSuite Cash Sale Line Custom Tax Code

  • custcol_otg_ipaas_tax_rate: NetSuite Cash Sale Line Custom Tax Percent

Other Custom Fields

  • custbody_es_bt_auth_by_external_pnref: External payment authorization reference flag

Mapping Custom Fields from iPaaS.com

To transfer custom fields from iPaaS.com, create an iPaaS.com subscription custom field with the same name as the NetSuite custom field ID. You may then create a mapping directly to the custom field.

NOTE: Free-form text is the only custom field data type currently supported.

Transaction custom field IDs may be found in the following NetSuite locations:

  • Cash Sale Custom Fields: Customization > Lists, Records & Fields > Transaction Body Fields

  • Cash Sale Line Item Custom Fields: Customization > Lists, Records & Fields > Transaction Line Fields

NOTE: Custom fields must be enabled on Sale transactions in NetSuite.

For the transfer of custom fields from iPaaS.com, create an iPaaS.com subscription custom field having the same name as the NetSuite custom field Id.

Transaction custom field Ids may be found in the following NetSuite locations:

  • Sales Order Custom Fields: Customization > Lists, Records & Fields > Transaction Body Fields

  • Sales Order Line Items Custom Fields: Customization > Lists, Records & Fields > Transaction Line Fields

Custom fields will need to be allowed on Sale transactions

Transaction Payment Requirements

NetSuite does not allow the payment method to be set when creating a customer deposit from an iPaaS.com transaction. As an alternative, template mappings provided include a translation collection to map iPaaS.com payment method names to NetSuite account IDs. It is recommended to use a different account for each external payment method. NetSuite account IDs can be found in Setup > Accounting > Chart of Accounts:

If no account is provided, NetSuite will use the undeposited funds account for all deposits from iPaaS.com. By default, all iPaaS.com transaction payments will be transferred. Add filters as needed to limit which payment statuses are transferred.

Location Requirements in Cash Sale

To transfer location Id from the iPaaS.com transaction to the NetSuite Cash Sale a Location Name must be set in the mapping collection dynamic formula of Cash Sale Add From iPaaS.com.

You can see the locationName to add in the mapping. Replace the locationName where indicated in the Dynamic Formula with the desired location.

Subsidiary Requirements in Cash Sale

To transfer Subsidiary Id from the iPaaS.com transaction to the NetSuite Cash Sale, a Subsidiary Name must be set in the mapping collection dynamic formula of Cash Sale Add From iPaaS.com.

You can see the subsidiaryName to add in the mapping. Replace the subsidiaryName where indicated in the Dynamic Formula with the desired subsidiary.

Cash Sale Accounting Period

Cash Sale created by iPaaS.com when you create a Cash Sale, NetSuite needs to know which period the revenue and associated payment should be recognized in. If the period is closed or the transaction date does not fall within an open period, NetSuite will not allow the transaction to be saved unless adjustments are made.

You can see the accountingperiodId to add in the mapping. Replace the accountingperiodIdwhere indicated in the Dynamic Formula with the desired accounting period.

Authentication and Security

NetSuite uses token-based authentication (TBA) or OAuth 2.0 to authorize API requests during transfer operations. OAuth 2.0 must be configured in NetSuite by creating an Integration Record, enabling Token-Based Authentication / OAuth 2.0, and granting the required permissions to the integration role. The generated Client ID and Client Secret are used by iPaaS.com to obtain an access token and securely authenticate API requests. Ensure credentials are stored securely within the iPaaS.com credential manager.

Integration Flow

The integration processes iPaaS.com Transaction records as follows:

  1. The transaction is created in iPaaS.com, and the mapping filter evaluates qualifying conditions (payment descriptions, status, and total).

  2. iPaaS.com authenticates with NetSuite using configured credentials.

  3. The NetSuite Customer ID is resolved via CustomerId external ID or email address lookup.

  4. Order status is mapped via a lookup translation table.

  5. Location ID and Subsidiary ID are resolved from configured names in the dynamic formulas.

  6. The transaction date is validated against the specified accounting period.

  7. Header fields are populated: memo (with payment summary and tax), email, totals, shipping method, and shipping cost.

  8. Tax override custom fields are populated (header-level tax code and rate).

  9. Address child collection maps, billing, and shipping addresses.

  10. Gift redemption is created if the Gift Card ID is provided in the iPaaS.com Payment MethodInfo field.

  11. Line item child collection maps each qualifying line (SKU validation, product type check, amount calculation).

  12. Cash Sale is created in NetSuite via API.

  13. NetSuite Cash Sale ID is saved as the External ID in iPaaS.com.

  14. Transfer status and any errors are logged in iPaaS.com.

Mappings

Parent: NetSuite Add Cash Sale FROM iPaaS

Description

This mapping collection creates NetSuite Cash Sales from qualifying iPaaS.com Transactions. It maps header-level information, including customer identification, order status, location, subsidiary, accounting period, memo details, shipping, and tax override fields. The CreateTransactionAs control field ensures the record is created as a Cash Sale rather than a Sales Order. Child collections handle addresses and line items.

Mapping Filter

if (Payments != null && Payments.Count > 0 && Payments.Exists(x => !string.IsNullOrWhiteSpace(x.Description) && !x.Description.Contains("House Account"))) { if (Status != "Refunded" && Status != "Partially Refunded" && Total >= 0) return true; } return false;

Description

This filter ensures that only qualifying transactions are transferred to NetSuite as Cash Sales. It validates that the Payments collection is not null, contains at least one payment, and at least one payment has a non-empty description that does not contain "House Account." It also checks that the status is not "Refunded" or "Partially Refunded" and that the total is non-negative. Transactions where all payment descriptions contain "House Account" are handled by the Sales Order mapping collection instead.

Mapping Type

Source (iPaaS.com)

Destination (NetSuite)

Description

Static

cash sale

CreateTransactionAs

(Required) Control field that directs NetSuite to create the record as a Cash Sale.

Dynamic Formula

var customerId = await GetExternalIdAsync(CustomerId, "Customer", SpaceportSystemId);
if (customerId == null || customerId == "")
return await GetCustomerIdByEmail(EmailAddress);
else
return customerId;

Entity_Id

(Required) Resolves the NetSuite Customer ID. First attempts to retrieve the external ID using the iPaaS.com CustomerId. If the CustomerId lookup fails, falls back to retrieving the Customer ID by email address. Unlike the Sales Order mapping, this formula does not include a CompanyId fallback. Transfer fails if no match is found.

Lookup Translation

OrderStatus_RefName

(Required) Maps iPaaS.com order status to NetSuite order status using the lookup translation table.

Dynamic Formula

var locationName = "California";
// UPDATE: Replace with your NetSuite location name
var locationId = await GetLocationIdByLocationName(locationName);
if (string.IsNullOrEmpty(locationId))
throw new Exception($"Failed to retrieve the location ID....");
return locationId;

Location_Id

(Required) Retrieves the NetSuite Location ID by name. The location name is hardcoded and must be updated to match your NetSuite configuration. If the name does not match a valid location, the transfer fails with an exception.

Dynamic Formula

var subsidiaryName = "HEADQUARTERS";
// UPDATE: Replace with your NetSuite subsidiary name
var subsidiaryId = await GetSubsidiaryIdBySubsidiaryName(subsidiaryName);
if (string.IsNullOrEmpty(subsidiaryId))
throw new Exception($"Failed to retrieve the subsidiary ID....");
return subsidiaryId;

Subsidiary_Id

(Required) Retrieves the NetSuite Subsidiary ID by name. The subsidiary name is hardcoded and must be updated to match your NetSuite configuration. If the name does not match a valid subsidiary, the transfer fails with an exception.

Dynamic Formula

var accountingperiodId = "201";
// UPDATE: Replace with your accounting period ID
if (TransactionCreatedDateTime == null)
throw new Exception("TransactionCreatedDatetime is null...");
return await CheckPostingGroupByTransactionDate(
TransactionCreatedDateTime, accountingperiodId);

TransactionDate

(Required) Validates the transaction date against the specified NetSuite accounting period. If TransactionCreatedDateTime is null, it throws an exception. The accounting period ID is hardcoded and must be updated for your environment.

Dynamic Formula

decimal total = 0;
string paymentMethod = "";
string tax = "$0";
if (TaxAmount != null)
tax = "$" + TaxAmount.ToString();
if (Payments != null) {
foreach (var payment in Payments) {
total += payment.Amount;
paymentMethod += " " + payment.Method + " ";
}
}
string paymentMethod = "";1
string paymentMethod = "";2
string paymentMethod = "";3
string paymentMethod = "";4
string paymentMethod = "";2
string paymentMethod = "";6
}

Memo

Generates a custom memo summarizing the transaction number, payment method(s), total payment amount, and tax. If no payments are recorded, the total is omitted.

Field

TransactionNumber

OtherRefNum

(Recommended) Maps the iPaaS.com transaction number as a reference.

Field

EmailAddress

Email

(Recommended) Maps the customer email address.

Field

Total

Total

(Recommended) Maps the transaction total.

Field

Subtotal

Subtotal

(Recommended) Maps the transaction subtotal.

Dynamic Formula

FieldFromFirstMatch(Addresses,
"IsPrimaryShipping == true", "ShippingMethod")

ShipMethod_RefName

(Recommended) Retrieves the shipping method name from the first address where IsPrimaryShipping is true.

Field

ShippingAmount

ShippingCost

(Recommended) Maps the shipping amount.

Field

ShippingAmount

AltShippingCost

(Recommended) Maps the shipping amount as the alternate shipping cost.

Static

TRUE

ShippingCostOverridden

Ensures the shipping cost from iPaaS.com overrides any NetSuite-calculated shipping.

Dynamic Formula

var result = (TaxAmount / Subtotal) * 100;
return Math.Round(result, 2);

custbody_otg_ipaas_tax_rate

Calculates the tax percentage from order totals, rounded to 2 decimal places.

Dynamic Formula

return 5;
// This is an example only — see Configuration Examples
// for region-based tax code mapping

custbody_otg_ipaas_tax_code

Maps the header-level tax code. Default returns a static value of 5. Must be updated for your configuration. See Configuration Examples for region-based mapping.

Static

TRUE

custbody_es_bt_auth_by_external_pnref

Sets the external payment authorization reference flag. Note: static values are treated as strings; use a dynamic formula (return true;) for a boolean value.

Lookup Translation Table

Source (iPaaS.com)

Destination (NetSuite)

Cancelled

Pending Approval

Refunded

Pending Approval

Complete

Pending Fulfillment

Partially Refunded

Pending Approval

Pending

Pending Fulfillment

Child 1: NetSuite Add Cash Sale Address FROM iPaaS

Description

This mapping collection maps iPaaS.com address records to NetSuite Cash Sale addresses. It handles both billing and shipping addresses, using the IsPrimaryBilling and IsPrimaryShipping flags to identify address roles.

Mapping Type

Source (iPaaS.com)

Destination (NetSuite)

Description

Field

Address1

Addr1

Maps the first address line.

Field

Address2

Addr2

Maps the second address line.

Field

Address3

Addr3

Maps the third address line.

Dynamic Formula

if (FirstName != null && FirstName != ""
&& LastName != null && LastName != "") {
return FirstName + " " + LastName;
} else {
return Company;
}

Addressee

Concatenates FirstName and LastName if both are present; defaults to Company name otherwise.

Field

City

City

Maps the city.

Field

Region

State

Maps the state or region.

Field

PostalCode

Zip

Maps the postal code.

Field

IsPrimaryBilling

IsPrimaryBilling

Identifies the primary billing address.

Field

IsPrimaryShipping

IsPrimaryShipping

Identifies the primary shipping address.

Child 2: NetSuite Add Cash Sale Line From iPaaS.com

Description

This mapping collection creates Cash Sale line items in NetSuite from iPaaS.com transaction lines. It validates that each SKU is linked to a NetSuite item and determines the line item type based on the product type in iPaaS.com.

Mapping Filter

var netSuiteProductId = await GetNetSuiteProductIdBySku(Sku); if (netSuiteProductId != null) { return true; } else { throw new Exception("Sku " + Sku + " does not exist in NetSuite as an item id"); }

Description

This filter validates that the line item SKU exists in NetSuite. If the SKU is found, the line is processed. If the SKU is not linked to a NetSuite item, the filter throws an exception and the line is not transferred.

Mapping Type

Source (iPaaS.com)

Destination (NetSuite)

Description

Dynamic Formula

if (Sku != null) {
var Type = await GetProductTypeBySku(Sku.ToString());
if (Type != null
&& (Type == "Physical" || Type == "Assembly Items")) {
return Type;
}
}

LineItemType

Determines the line item type by looking up the product type in iPaaS.com. Returns the type if it is "Physical" or "Assembly Items."

Field

Description

Description

Maps the line item description.

Dynamic Formula

// When applying only a header-level discount in NetSuite,
// use the non-discounted item price.
// Adjust according to your source discount handling!
return Qty * OriginalUnitPrice
;

Amount

Calculates the line amount using the non-discounted unit price. When applying only a header-level discount in NetSuite, this ensures the line amount reflects the pre-discount price. Adjust if your source includes discounted extended prices.

Field

Qty

Quantity

Maps the line item quantity.

Dynamic Formula

await GetNetSuiteProductIdBySku(Sku)

Item_Id

(Required) Retrieves the NetSuite item ID by SKU.

Child 3: NetSuite Cash Sale Gift Redemption FROM iPaaS

Description

This mapping filter ensures that only gift cards with a valid corresponding NetSuite Gift Certificate are processed. It prevents creating orders in NetSuite with invalid or unmapped gift cards, maintaining data integrity between iPaaS.com and NetSuite.

NOTE: Update filters as needed to transfer only the desired payments.

Mapping Type

Source (iPaaS.com)

Destination (NetSuite)

Description

Static

Gift Card

PaymentMethodType

Maps the static value to the payment method type

Dynamic Formula

string giftCardIdValue = null;
if (MethodInfo != null &&
MethodInfo.TryGetValue("GiftCardId", out var giftCardId) &&
!string.IsNullOrEmpty(giftCardId?.ToString()))
{
giftCardIdValue = giftCardId.ToString();
var netsuiteGiftCertificateId = await ValidateNetSuiteGiftCertificateAsync(giftCardIdValue);
if(!string.IsNullOrEmpty(netsuiteGiftCertificateId)) {
return netsuiteGiftCertificateId;
}
else {
throw new Exception("Gift Certificate does not exist in NetSuite.");
}
}
else {
throw new Exception("GiftCardId is missing or invalid in MethodInfo.");
}

GiftCertRedemption_AuthCode_Id

This mapping extracts the GiftCardId from the Payment MethodInfo, validates it in NetSuite, and returns the corresponding gift certificate ID for redemption. If the value is missing, invalid, or not found in NetSuite, an exception is thrown.

Field

Amount

GiftCertRedemption_AuthCodeApplied

Maps the payment Amount to the gift certificate redemption applied amount, representing how much value is redeemed from the gift card.

Field

Method

GiftCertRedemption_AuthCode_RefName

Maps the payment Method to the gift certificate reference name, identifying the payment method used for the gift card redemption.

Child 4: NetSuite Sales Order Gift Card Line Add FROM iPaaS

Mapping Filter

var netsuiteGiftCertificateId = await GetGiftCertificateIdBySkuAsync(Sku);
if(netsuiteGiftCertificateId != null) {
if(Qty > 1) {
throw new Exception("Gift card quantity cannot be greater than 1. NetSuite supports only one gift certificate per transaction line");
return false;
}
else {
return true;
}
}
else {
return false;
}

Description

This mapping filter verifies that a corresponding NetSuite Gift Certificate item exists for the SKU. If the item exists, the line is allowed to transfer; otherwise, it throws an exception to prevent creating a Gift Card line without a matching NetSuite item.

Mapping Type

Source (iPaaS.com)

Destination (NetSuite)

Description

Field

Qty

Quantity

Maps the line item quantity.

Field

Description

Description

Maps the line item description.

Dynamic Formula

Parent.SystemId;

GiftCertificateFrom

Maps the line item GiftCertificateFrom.

Field

AssignedIdentification
(custom Field)

GiftCertificateMessage

Maps the line item GiftCertificateMessage.

Dynamic Formula

var companyId = await GetExternalIdAsync(Parent.CompanyId, "Company", SpaceportSystemId);
if (!string.IsNullOrEmpty(companyId)) {
return await GetCustomerDetailByIdAsync(companyId,"email");
}
var customerId = await GetExternalIdAsync(Parent.CustomerId, "Customer", SpaceportSystemId);
if (!string.IsNullOrEmpty(customerId)) {
return await GetCustomerDetailByIdAsync(customerId,"email");
}
if (string.IsNullOrEmpty(customerId)) {
return await GetCustomerDetailByEmailAsync(Parent.EmailAddress,"email");
}

GiftCertificateRecipientEmail

Retrieves the recipient email for the gift certificate line item by checking the Company or Customer external ID in NetSuite. If neither is found, it looks up the customer using the transaction email address.

Dynamic Formula

var companyId = await GetExternalIdAsync(Parent.CompanyId, "Company", SpaceportSystemId);
if (!string.IsNullOrEmpty(companyId)) {
return await GetCustomerDetailByIdAsync(companyId,"name");
}
var customerId = await GetExternalIdAsync(Parent.CustomerId, "Customer", SpaceportSystemId);
if (!string.IsNullOrEmpty(customerId)) {
return await GetCustomerDetailByIdAsync(customerId,"name");
}
if (string.IsNullOrEmpty(customerId)) {
return await GetCustomerDetailByEmailAsync(Parent.EmailAddress,"name");
}

GiftCertificateRecipientName

Retrieves the recipient name for the gift certificate line item by checking the Company or Customer external ID in NetSuite. If neither is found, it looks up the customer using the transaction email address.

Dynamic Formula

// ExtendedPrice
//Some iPaaS transactions include discounted amounts in the
//line item extended price. When passing a header discount only to //NetSuite, a non-discounted item price should often be used. //Adjust according to your source line item discount handling!
return Qty * OriginalUnitPrice;

Amount

Calculates the line amount using non-discounted unit price. Adjust if your source includes discounted extended prices.

Dynamic Formula

if(Sku != null)
{
var Type = await GetProductTypeBySku(Sku.ToString());
if(Type != null && (Type == "Physical"||Type == "Assembly Items")){
return Type;
}
}

LineItemtype

The mapping checks the SKU of a product and retrieves its type. If the product type exists and is either "Physical" or "Assembly Items", it returns that type. This ensures only valid product types are processed in downstream mappings.

Dynamic Formula

var giftCertificateId = await GetGiftCertificateIdBySkuAsync(Sku);
return giftCertificateId.ToString();

Item_Id

(Required) Retrieves the NetSuite Gift Certificate item ID by SKU.

Configuration Examples

The following code examples are provided as templates in the integration mapping. They are commented out by default and must be customized to match your NetSuite configuration before use.

Region-Based Tax Code Mapping (Header or Line Level)

This example maps iPaaS.com tax information to a NetSuite tax code ID based on the customer's country and region. It applies to both custbody_otg_ipaas_tax_code (header) and custcol_otg_ipaas_tax_code (line) fields.

// This is an example only and must be updated to your configuration! var country = GetCustomFieldValue(CustomFields, "NetSuite Tax Code Country"); var region = GetCustomFieldValue(CustomFields, "NetSuite Tax Code Region"); // Depending on your order source, normalize the country here country = CountryCodeRequired(country); // Map the country and region to a NetSuite tax code ID if (country == "US") { // This function will abbreviate US or Canada regions region = StateAbbreviation(region); switch (region) { case "NJ": return "-11"; // NJ in NetSuite break; case "NY": throw new Exception("Unmapped tax code"); // Throws an error break; default: // Default when no region match is found return "5"; break; } } // Add else if for each country // else if () ... else { // Default when no country match is found return "-7"; // Not taxable in NetSuite }

Customization notes

  • Add case entries for each state or region requiring a specific tax code ID

  • Add else if blocks for additional countries

  • Ensure "NetSuite Tax Code Country" and "NetSuite Tax Code Region" custom fields exist in iPaaS.com

  • For line-level usage, reference Parent.CustomFields instead of CustomFields

Line-Level Tax Percent Fallback

This example calculates the line-level tax percentage using a three-step fallback: line TaxPercent, estimated tax amount, or order header totals.

// Tax percent is provided if (TaxPercent != null && TaxPercent != 0) { return Math.Round(TaxPercent, 2); } // Estimated tax amount is provided — calculate percentage if (EstimatedTaxAmount != null && EstimatedTaxAmount != 0) { var result1 = (EstimatedTaxAmount / ExtendedPrice) * 100; return Math.Round(result1, 2); } // No line tax information — use order header amounts if (TaxPercent == null || TaxPercent == 0 || EstimatedTaxAmount == null || EstimatedTaxAmount == 0) { var result2 = (Parent.TaxAmount / Parent.Subtotal) * 100; return Math.Round(result2, 2); }

Error Handling

Customer Not Found

Entity_Id is null or empty — API exception on Cash Sale creation.

  • Description: Neither the CustomerId external ID nor the email address resolved a NetSuite Customer ID.

  • Resolution: Ensure the customer exists in NetSuite and that the iPaaS.com CustomerId has a valid external ID mapped. Verify the email address matches the NetSuite customer record.

Location Not Found

Failed to retrieve the location ID.

  • Description: The location name specified in the Location_Id dynamic formula does not match a valid NetSuite location.

  • Resolution: Update the location name in the Location_Id formula to match a valid NetSuite location. Verify the location exists and is spelled correctly.

Subsidiary Not Found

Failed to retrieve the subsidiary ID.

  • Description: The subsidiary name specified in the Subsidiary_Id dynamic formula does not match a valid NetSuite subsidiary.

  • Resolution: Update the subsidiary name in the Subsidiary_Id formula to match a valid NetSuite subsidiary. Verify the subsidiary exists and is spelled correctly.

Accounting Period Closed

Transaction date does not fall within an open accounting period.

  • Description: NetSuite rejected the Cash Sale because the transaction date falls outside the allowable range of the specified accounting period, or the period is closed.

  • Resolution: Verify the accounting period ID in the TransactionDate formula matches an open period. Ensure the transaction date falls within the period's date range.

SKU Not Linked to NetSuite Item

Sku [SKU] does not exist in NetSuite as an item id.

  • Description: The line item SKU could not be resolved to a NetSuite item ID.

  • Resolution: Ensure the product exists in NetSuite and that the iPaaS.com product's external ID is set to the NetSuite item internal ID. Run a product sync if needed.

Unmapped Tax Code

Unmapped tax code (thrown by example formula).

  • Description: The region-based tax code mapping encountered a region without a configured tax code.

  • Resolution: Add the missing region to the tax code switch statement in the dynamic formula.

Gift Card Not Found/Invalid GiftCardId

Gift Certificate does not exist in NetSuite.

  • Description: The provided GiftCardId was found in MethodInfo, but no corresponding gift certificate exists in NetSuite, causing the validation method to fail.

  • Resolution: Verify that the GiftCardId is correct and that the gift certificate exists in NetSuite. Ensure the ID is properly synced and mapped between iPaaS.com and NetSuite.

Missing or Invalid GiftCardId

GiftCardId is missing or invalid in MethodInfo

  • Description: The MethodInfo object is null, does not contain GiftCardId, or the value is empty/invalid, preventing the mapping from executing.

  • Resolution: Ensure that MethodInfo includes a valid, non-empty GiftCardId field before processing the mapping. Validate input data at the source.

Validation and Testing

Validation Rules

  • The Entity_Id field uses a two-step fallback (CustomerId → email). Ensure at least one resolution path is valid for each transaction.

  • Line items are validated against NetSuite before inclusion. The line filter throws an exception if a SKU is not linked to a NetSuite item.

  • The Location_Id and Subsidiary_Id formulas contain hardcoded names. Verify these match valid NetSuite records before testing.

  • The TransactionDate formula validates the transaction date against a hardcoded accounting period ID. Verify the period is open, and the ID is correct.

  • Tax override custom fields must exist in NetSuite before they can be populated.

  • The mapping filter verifies that each gift card line SKU corresponds to an existing NetSuite Gift Certificate item before the line is transferred.

  • The mapping validates that the provided GiftCardId corresponds to an existing gift certificate in NetSuite before processing the redemption.

Validation Checklist

  1. Entity_Id resolves to a valid NetSuite Customer ID for test transactions.

  2. The order status lookup translation table is configured with all expected iPaaS.com statuses.

  3. All line item SKUs are linked to NetSuite items (external IDs set).

  4. Location name in the Location_Id formula matches a valid NetSuite location.

  5. Subsidiary name in the Subsidiary_Id formula matches a valid NetSuite subsidiary.

  6. Accounting period ID in the TransactionDate formula matches an open period.

  7. Tax override custom fields exist in NetSuite if tax mappings are active.

  8. Shipping methods in iPaaS.com match configured NetSuite shipping methods.

  9. Custom fields are enabled on Sale transactions in NetSuite.

  10. Gift certificate SKUs are linked to NetSuite gift certificates (if gift card lines are used).

  11. Gift certificate items exist and are active in NetSuite.

  12. Ensure that the GiftCardId field exists and is not empty.

  13. Verify that the GiftCardId corresponds to a valid gift certificate record in NetSuite.

  14. Ensure that the internal NetSuite ID returned by validation matches the GiftCardId used in iPaaS.com.

Test Scenarios

Scenario 1: Standard Cash Sale Creation

Sync a qualifying transaction from iPaaS.com with standard line items and a non-"House Account" payment. Cash Sale should be created in NetSuite with correct header details, addresses, and line items. Verify the memo contains the payment summary and tax information.

Scenario 2: Customer Fallback Resolution

Sync a transaction where the CustomerId external ID does not exist. Verify the system falls back to email address lookup.

Scenario 3: SKU Not Found (Failure Case)

Sync a transaction with a line item SKU that does not exist in NetSuite. Verify the line filter throws an exception, and the error is logged.

Scenario 4: Invalid Location Name (Failure Case)

Update the Location_Id formula with an invalid location name. Sync a transaction and verify the transfer fails with a location not found exception.

Scenario 5: Closed Accounting Period (Failure Case)

Sync a transaction with a date that falls outside the configured accounting period. Verify the transfer fails with an appropriate error.

Scenario 6: Tax Override Fields

Sync a transaction and verify that custbody_otg_ipaas_tax_rate is calculated correctly from TaxAmount and Subtotal.

Scenario 7: "House Account" Payment Routing

Sync a transaction where all payment descriptions contain "House Account." Verify the Cash Sale filter rejects it (confirming it would be routed to the Sales Order mapping instead).

Scenario 8: Gift Card SKU Not Found (Failure Case)

Sync a transaction where the gift card SKU does not exist in NetSuite. Verify that the line is filtered out and an appropriate error is logged.

Scenario 9: Gift Card Validation Failures (Failure Case)

Sync a transaction where the gift card SKU does not exist in NetSuite or the gift card line item quantity is greater than 1. Verify that the line is filtered out or the transaction fails with an appropriate error logged, ensuring that only valid NetSuite Gift Certificate items with a quantity of 1 are processed.

Scenario 10: GiftCardId Missing or Invalid (Failure Case)

Sync a transaction where the MethodInfo object does not contain a GiftCardId or the value is empty/invalid. Verify that the transaction fails with the error “GiftCardId is missing or invalid in MethodInfo” logged, ensuring that no redemption is attempted without a valid GiftCardId.

Scenario 11: Gift Certificate Does Not Exist in NetSuite (Failure Case)

Sync a transaction where the provided GiftCardId does not correspond to any existing gift certificate in NetSuite. Verify that the transaction fails with the error “Gift Certificate does not exist in NetSuite” logged, ensuring that only valid gift certificates are processed for redemption.

Additional Notes

  • The CreateTransactionAs field must be set to "cash sale" to create a Cash Sale rather than a Sales Order. This is a control field handled by the static mapping.

  • The Location_Id, Subsidiary_Id, and TransactionDate formulas all contain hardcoded values. These must be updated for each deployment.

  • The custbody_es_bt_auth_by_external_pnref field is set as a static string "TRUE." If a boolean is required, use a dynamic formula: return true;.

  • The Entity_Id resolution in this mapping does not include a CompanyId fallback (unlike the Sales Order mapping). If CompanyId resolution is needed, update the Entity_Id formula.

  • The line item Amount calculation uses OriginalUnitPrice (non-discounted). Adjust if your source includes discounted extended prices.

  • Tax items assigned to NetSuite customers may apply additional tax on shipping or handling. iPaaS.com tax totals in the memo can be used for comparison.

  • Ensure dynamic formulas return valid output; null or invalid returns may cause transfer failures.

  • Gift certificate lines require a valid NetSuite Gift Certificate item. Standard inventory or non-inventory items cannot be used for gift card lines.

Did this answer your question?