Overview
When a transaction is updated in iPaaS.com that meets all qualifying conditions — including at least one line item, a status that is not cancelled or refunded, and a non-negative total — it is transferred to NetSuite as a Sales Order. This mapping collection handles the creation of Sales Orders, including header-level details, address information, customer deposits, gift redemption, line items, and gift card line items.
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 your NetSuite implementation team to implement overrides of the NetSuite-calculated tax amount after the sales order has been updated.
Before You Begin
Ensure the following prerequisites are in place before configuring this integration.
iPaaS.com Requirements
The transaction must have at least one line item.
Transaction status must not be "Cancelled", "Refunded", or "Partially Refunded".
Transaction type must not be "Validated Return" or "Invoice".
Transaction numbers must not end with "-D" or "-GC".
The transaction total must be greater than or equal to 0.
Gift-card-only orders are excluded.
If a Payments collection is present, all payments must have a non-empty Description containing "House Account".
Line item SKUs should be linked to existing NetSuite items, and the item must not be configured as a Gift Certificate item in NetSuite.
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), the iPaaS.com gift card Id must exist in iPaaS.com as a 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.
If using tax overrides, the required custom fields must be created (see Custom Fields Support).
If using fulfillment, warehouse locations must be configured with valid inventory.
Shipping methods must be configured to match iPaaS.com shipping method names.
Discount items must exist if discount mappings are used.
For gift redemption (Transaction Payment in iPaaS), the iPaaS.com gift card Id must exist in NetSuite as 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 manual sync page.
External ID Format: The NetSuite Sales Order internal ID will be saved as the external ID in iPaaS.com.
Mapping Collection Status
Status: Enabled
Trigger Events: Update
Supported Child Collections
This flow uses three child collections to create the complete Sales Order record in NetSuite:
Data Requirements
The following fields are required for successful Sales Order creation.
Mandatory Header Fields
Entity_Id (NetSuite Customer ID)
OrderStatus_RefName (via lookup translation)
Recommended Header Fields
Memo
Email
Total
Subtotal
OtherRefNum (Transaction Number)
ShipMethod_RefName
ShippingCos/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 mapping filter applies multiple conditions to determine whether a transaction qualifies for transfer. Transactions that are gift-card-only orders, cancelled, refunded, partially refunded, validated returns, or invoices are excluded. The transaction total must be non-negative, and if payments exist, all payment descriptions must contain "House Account."
Customer Resolution: The Entity_Id mapping uses a multi-step fallback to resolve the NetSuite Customer ID. It first attempts to look up the external ID using the CompanyId, then falls back to the CustomerId, and finally attempts a lookup by email address. If none of these resolve, the transfer will fail with an API exception.
Gift Card Existence Validation: Before creating a NetSuite 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 the NetSuite calculated tax. Consult your NetSuite implementation team if tax overrides are required.
Discount Handling: The template uses a static NetSuite discount item ID ("241") as a catch-all for website discounts. Update this ID to match your specific NetSuite discount item. Discount mappings only fire when DiscountAmount is greater than 0.
Fulfillment Control: The CreateItemFulfillment and LocationId_Fulfillment fields are control fields. By default, the template sets CreateItemFulfillment to false and LocationId_Fulfillment to 0, meaning no fulfillment records are generated. See Configuration Examples for enabling fulfillment with inventory validation.
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 Product 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 line is flagged. The filter also ensures that the SKU is not configured as a Gift Certificate item.
SKU Validation on Gift Card Lines: Line item filters validate that each SKU exists in NetSuite before including the line. If a SKU is not linked to a NetSuite Gift Certificate item, the line is flagged. The filter ensures that only SKUs configured as Gift Certificate items are included.
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.
Commented-Out Code Several dynamic formulas in this template contain commented-out example code for tax code mapping and fulfillment location logic. These are provided as starting points and must be updated to match your specific NetSuite configuration before uncommenting.
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 Sales Order Header Custom Tax Code
custbody_otg_ipaas_tax_rate: NetSuite Sales Order 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 Sales Order Line Custom Tax Code
custcol_otg_ipaas_tax_rate: NetSuite Sales Order Line Custom Tax Percent
Other Custom Fields
custbody_es_bt_auth_by_external_pnref: External payment authorization reference flag.
custbodycustbody_otg_ipaas_original_or: Stores the original iPaaS order total.
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.
You may then create a mapping directly to the custom field:
Important! Free-Form text is the only custom field data type currently supported. |
Transaction custom field IDs may be found in the following NetSuite locations:
Sales Order Custom Fields: Customization > Lists, Records & Fields > Transaction Body Fields in the ID column.
Sales Order Line Items Custom Fields: Customization > Lists, Records & Fields > Transaction Line Fields in the Internal ID column.
NOTE: Custom fields will need to be allowed on Sale transactions. Under Transaction Body Field, select the Applies To Sales checkbox. |
Authentication and Security
NetSuite uses token-based authentication (TBA) or OAuth 2.0 to authorize API requests during transfer operations. Ensure credentials are stored securely within the iPaaS.com credential manager.
Integration Flow
The integration processes iPaaS.com Transaction records as follows:
The transaction is updated in iPaaS.com, and the mapping filter evaluates qualifying conditions (status, type, line count, total, payment descriptions).
iPaaS.com authenticates with NetSuite using configured credentials.
The NetSuite Customer ID is resolved via CompanyId external ID, CustomerId external ID, or email address lookup.
Order status is mapped via a lookup translation table.
Header fields are populated: memo (with payment summary and tax), email, totals, shipping method, and shipping cost.
Discount fields are conditionally populated if a discount amount exists.
Tax override custom fields are populated (header-level tax code and rate).
Address child collection maps, billing, and shipping addresses.
Customer deposit child collection maps payment amounts with account lookup.
Gift redemption is created if the Gift Card ID is provided in the iPaaS.com Payment MethodInfo field.
Line item child collection maps each qualifying line (SKU validation, amount calculation, tax fields, fulfillment control fields).
Sales Order is updated in NetSuite via API.
NetSuite Sales Order ID is saved as the External ID in iPaaS.com.
Transfer status and any errors are logged in iPaaS.com.
Mappings
Parent: NetSuite Sales Order Update From iPaaS
Description
This mapping collection creates NetSuite Sales Orders from qualifying iPaaS.com Transactions. It maps header-level information, including customer identification, order status, memo details, shipping, discounts, and tax override fields. Child collections handle addresses, payments, and line items.
Mapping Filter
if (1==1 &&
(Payments == null || Payments.All(x => !string.IsNullOrWhiteSpace(x.Description) && x.Description.Contains("House Account"))) &&
Lines.Count > 0 &&
!TransactionNumber.EndsWith("-D") &&
!TransactionNumber.EndsWith("-GC") &&
Type != "Validated Return" &&
Type != "Invoice" &&
Status != "Cancelled" &&
Status != "Refunded" &&
Status != "Partially Refunded")
{
return true;
}
return false;
Description
This filter ensures that only qualifying transactions are transferred to NetSuite as Sales Orders. It validates that the transaction contains at least one line item, the transaction number does not end with “-D” or “-GC”, the transaction type is not Validated Return or Invoice, and the status is not Cancelled, Refunded, or Partially Refunded. Additionally, if a Payments collection exists, all payments must have a non-empty description that contains “House Account.” Only transactions meeting all these conditions are allowed to transfer.
Mapping Type | Source (iPaaS.com) | Destination (NetSuite) | Description |
Static | true | custbody_es_bt_auth_by_external_pnref (custom field) | Sets the external payment authorization reference flag. Note: static values are treated as strings; use a dynamic formula (return true;) for boolean values. |
Dynamic Formula |
| custbody_otg_ipaas_tax_rate (custom field) | Calculates the tax percentage from order totals, rounded to 2 decimal places. |
Dynamic Formula |
| custbody_otg_ipaas_tax_code | Maps the header-level tax code. Default returns a static value; see Configuration Examples for region-based tax code mapping. |
Dynamic Formula |
| 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 | Maps the iPaaS.com transaction number as a reference. |
Field | EmailAddress | Maps the customer email address. | |
Static | true | ShippingCostOverridden | Ensures the shipping cost from iPaaS.com overrides any NetSuite-calculated shipping. |
Field | Subtotal | Subtotal | Maps the transaction subtotal. |
Field | Total | Total | Maps the transaction total. |
Dynamic Formula |
| Entity_Id | (Required) Resolves the NetSuite Customer ID. Falls back through CompanyId external ID → CustomerId external ID → email address lookup. Transfer fails if no match is found. |
Lookup Translation | OrderStatus_RefName | Maps iPaaS.com order status to NetSuite order status using the "NetSuite Order Status From iPaaS" translation table (ID: 22270). | |
Field | ShippingAmount | ShippingCost | Maps the shipping amount. |
Dynamic Formula |
| ShipMethod_RefName | Retrieves the shipping method name from the primary shipping address using the FieldFromFirstMatch function. |
Dynamic Formula |
| DiscountAmount | Passes through the discount amount when present; returns null otherwise. |
Field | ShippingAmount | AltShippingCost | Maps the shipping amount. |
Dynamic Formula |
| DiscountRate | Returns the discount amount as a negative value for NetSuite's discount rate field. |
Dynamic Formula |
| DiscountItem_Id | Returns a static NetSuite discount item ID ("241") when a discount exists. Update this ID to match your NetSuite configuration. |
Dynamic Formula |
| DiscountItem_Rate | Passes through the discount amount as the item rate when present. |
Static | More | ShipMethod_ShippingCarrier | Sets a static shipping carrier 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 Sales Order Address Update From iPaaS
Description
This mapping collection maps iPaaS.com address records to NetSuite Sales Order 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. |
Dynamic Formula |
| 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. |
Field | Address3 | Addr3 | Maps the third address line. |
Child 2: NetSuite Sales Order Customer Deposit Update From iPaaS
Description
This mapping collection maps iPaaS.com payment records to NetSuite customer deposit records associated with the Sales Order. The account is resolved via lookup translation.
NOTE: Update filters as needed to transfer only the desired payments. |
Mapping Type | Source (iPaaS.com) | Destination (NetSuite) | Description |
Field | Amount | Payment | Maps the payment amount. |
Lookup Translation | Account_Id | Maps the payment account using the "NetSuite Sales Order Payment Account From iPaaS" translation table (ID: 22272). |
Lookup Translation Table
Source (iPaaS.com) | Destination (NetSuite |
Cash | 4 |
Check | 5 |
American Express | 4 |
Discover | 4 |
Master Charge | 4 |
Visa | 4 |
Cash on delivery | 4 |
Child 3: NetSuite Sales Order Gift Redemption Update 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 |
| 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 5: NetSuite Sales Order Line Update From iPaaS
Mapping Filter
var netsuiteGiftCertificateId = await GetGiftCertificateIdBySkuAsync(Sku);
if(netsuiteGiftCertificateId != null) {
return false;
}
else {
var netSuiteProductId = await GetNetSuiteProductIdBySku(Sku);
if(netSuiteProductId != null){
return true;
}
else{
throw new Exception("Sku "+Sku+" is not linked to a NetSuite item id");
}
}
Description
This mapping filter ensures that only valid line items are transferred to NetSuite. It first checks if the SKU corresponds to a NetSuite Gift Certificate item; if it does, the line is excluded from transfer to prevent duplicate gift card creation. If the SKU is not a gift certificate, the filter then verifies whether it is linked to an existing standard NetSuite item. If a valid NetSuite item is found, the line is allowed to transfer; otherwise, an exception is thrown with a message indicating that the SKU is not linked to a NetSuite item. This validation prevents errors during Sales Order or Cash Sale creation and ensures that all transferred line items have corresponding records in NetSuite.
Mapping Type | Source (iPaaS.com) | Destination (NetSuite) | Description |
Dynamic Formula |
| custcol_otg_ipaas_tax_code | Line-level tax code. Default returns null; see Configuration Examples for region-based mapping. |
Dynamic Formula |
| custcol_otg_ipaas_tax_rate | Calculates line-level tax rate using TaxPercent, EstimatedTaxAmount, or order header totals as fallbacks. |
Dynamic Formula |
| CreateItemFullfilment | Control field: set to true to generate a fulfillment record, false to skip. Default is false. |
Dynamic Formula |
| LocationId_Fullfilment | Control field for fulfillment location. Default returns 0 (no fulfillment). See Configuration Examples for inventory-validated location lookup. |
Dynamic Formula |
| ItemRecieved | Marks the item as received. |
Field | Qty | Quantity | Maps the line item quantity. |
Field | Description | Description | Maps the line item description. |
Dynamic Formula |
| Amount | Calculates the line amount using non-discounted unit price. Adjust if your source includes discounted extended prices. |
Dynamic Formula |
| Item_Id | (Required) Retrieves the NetSuite item ID by SKU. |
Child 4: NetSuite Sales Order Gift Card Line Update From iPaaS
Mapping Filter
if(Type == "Gift Card" && LineInfo.ContainsKey("GiftCardId") && LineInfo["GiftCardId"] != null && !string.IsNullOrEmpty(LineInfo["GiftCardId"].ToString())){
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;
}
}
return false;
Description
This mapping filter applies to gift card line items. It first verifies that the line represents a gift card and that a GiftCardId is present. The filter then checks whether the SKU is linked to an existing NetSuite Gift Certificate item. If a matching item exists, it validates that the quantity does not exceed one, since NetSuite supports only one gift certificate per transaction line. If the quantity is greater than one, an exception is thrown to prevent the transaction from transferring. If no corresponding NetSuite Gift Certificate item is found, the line is excluded from the transfer.
Mapping Type | Source (iPaaS.com) | Destination (NetSuite) | Description |
Dynamic Formula |
| custcol_otg_ipaas_tax_code | Line-level tax code. Default returns null; see Configuration Examples for region-based mapping. |
Dynamic Formula |
| custcol_otg_ipaas_tax_rate | Calculates line-level tax rate using TaxPercent, EstimatedTaxAmount, or order header totals as fallbacks. |
Dynamic Formula |
| CreateItemFullfilment | Control field: set to true to generate a fulfillment record, false to skip. Default is false. |
Dynamic Formula |
| LocationId_Fullfilment | Control field for fulfillment location. Default returns 0 (no fulfillment). See Configuration Examples for inventory-validated location lookup. |
Dynamic Formula |
| ItemRecieved | Marks the item as received. |
Field | Qty | Quantity | Maps the line item quantity. |
Field | Description | Description | Maps the line item description. |
Dynamic Formula |
| GiftCertificateFrom | Maps the line item GiftCertificateFrom. |
Field | AssignedIdentification (Custom Field) | GiftCertificateMessage | Maps the line item GiftCertificateMessage. |
Dynamic Formula |
| 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 |
| 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 |
| Amount | Calculates the line amount using non-discounted unit price. Adjust if your source includes discounted extended prices. |
Dynamic Formula |
| Item_Id | (Required) Retrieves the NetSuite Gift Certificate item ID by SKU. |
Child 5: NetSuite Sales Order Line Update From iPaaS
Mapping Filter
var netsuiteGiftCertificateId = await GetGiftCertificateIdBySkuAsync(Sku);
if(netsuiteGiftCertificateId != null) {
return false;
}
else {
var netSuiteProductId = await GetNetSuiteProductIdBySku(Sku);
if(netSuiteProductId != null){
return true;
}
else{
throw new Exception("Sku "+Sku+" is not linked to a NetSuite item id");
}
}
Description
This mapping filter ensures that only valid line items are transferred to NetSuite. It first checks if the SKU corresponds to a NetSuite Gift Certificate item; if it does, the line is excluded from transfer to prevent duplicate gift card creation. If the SKU is not a gift certificate, the filter then verifies whether it is linked to an existing standard NetSuite item. If a valid NetSuite item is found, the line is allowed to transfer; otherwise, an exception is thrown with a message indicating that the SKU is not linked to a NetSuite item. This validation prevents errors during Sales Order or Cash Sale creation and ensures that all transferred line items have corresponding records in NetSuite.
Mapping Type | Source (iPaaS.com) | Destination (NetSuite) | Description |
Dynamic Formula |
| custcol_otg_ipaas_tax_code | Line-level tax code. Default returns null; see Configuration Examples for region-based mapping. |
Dynamic Formula |
| custcol_otg_ipaas_tax_rate | Calculates line-level tax rate using TaxPercent, EstimatedTaxAmount, or order header totals as fallbacks. |
Dynamic Formula |
| CreateItemFullfilment | Control field: set to true to generate a fulfillment record, false to skip. Default is false. |
Dynamic Formula |
| LocationId_Fullfilment | Control field for fulfillment location. Default returns 0 (no fulfillment). See Configuration Examples for inventory-validated location lookup. |
Dynamic Formula |
| ItemRecieved | Marks the item as received. |
Field | Qty | Quantity | Maps the line item quantity. |
Field | Description | Description | Maps the line item description. |
Dynamic Formula |
| Amount | Calculates the line amount using non-discounted unit price. Adjust if your source includes discounted extended prices. |
Dynamic Formula |
| Item_Id | (Required) Retrieves the NetSuite 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.
Taxes Requirements
NetSuite will calculate its own tax amounts based on the customer, item, and shipping method configuration. It is not possible to set these amounts from iPaaS.com using the API. Template mappings indicate 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 sales order has been updated in NetSuite. These customizations will require the following:
Transaction custom fields having the following Ids:
When using order level tax collection in NetSuite:
custbody_otg_iPaaS.com_tax_code - NetSuite Sales Order Header Custom Tax Code
custbody_otg_iPaaS.com_tax_rate - NetSuite Sales Order Header Custom Tax Percent
When using line item level tax collection in NetSuite:
custcol_otg_iPaaS.com_tax_code - NetSuite Sales Order Line Custom Tax Code
custcol_otg_iPaaS.com_tax_rate - NetSuite Sales Order Line Custom Tax Percent
The NetSuite tax code must be provided. The example formula below will use transaction custom fields (that must be populated by your order source) to select the appropriate tax code ID in NetSuite. This step should be completed by your integrator or implementation team.
//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 NetSuiteThe tax percent override must be provided. The example formula below calculates this percentage from the order totals:
var result = (TaxAmount / Subtotal) * 100;
//Round to specified number of decimal places
return Math.Round(result, 2);
Examples of formulas 2 and 3 above for line item tax collection:
Tax Code:
//This is an example only and must be updated to your configuration!
var country = GetCustomFieldValue(Parent.CustomFields, "NetSuite Tax Code Country");
var region = GetCustomFieldValue(Parent.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":
thrownewexception("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
}
Tax Percent:
//Some integrations may or may not provide line tax information.
//In situations where it is not, the order header totals are used
//Adjust the header total filters as needed
//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);
Important! Tax items assigned to customers may apply additional tax amounts for the shipping or handling on a sales order. When iPaaS.com creates a new customer, it will not have these tax items assigned by default, they may be added to existing customers. If this tax item charges tax on shipping amounts, NetSuite will add this amount to a Sales Order automatically. Tax totals from iPaaS.com are included in the memo generated by template mappings for comparison. |
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.
Fulfillment Location with Inventory Validation
This example validates that a product exists at a specific warehouse location with non-zero inventory before returning the location ID for fulfillment.
if (Sku != null && !string.IsNullOrEmpty(Sku)) { var LocationId = await CheckLocationQuantityByLocationNameAndProductBySku( "US Warehouse", Sku.ToString() ); if (LocationId != null && LocationId > 0) { return LocationId; } }
Customization notes
Replace "US Warehouse" with your NetSuite warehouse location name
The function checks product existence and inventory quantity at the specified location
If the inventory quantity is zero, an exception is thrown to prevent fulfillment at an empty location
The line item SKU must have its external ID set, and the product must exist in NetSuite
Set CreateItemFulfillment to true in the same collection to enable fulfillment generation
Error Handling
Customer Not Found
Entity_Id is null or empty — API exception on Sales Order creation.
Description: None of the fallback methods (CompanyId, CustomerId, email) resolved a NetSuite Customer ID.
Resolution: Ensure the customer exists in NetSuite and that the iPaaS.com CompanyId or CustomerId has a valid external ID mapped. Verify the email address matches the NetSuite customer record.
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.
SKU Not Linked to NetSuite Item
Sku [SKU] is not linked to a NetSuite 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.
Invalid Discount Item ID
Discount item not found or invalid.
Description: The static discount item ID ("241") does not match a valid NetSuite item.
Resolution: Update the DiscountItem_Id mapping formula to use your NetSuite discount item's internal ID.
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.
Invalid Price List or Tax Configuration
Transfer fails with NetSuite validation errors.
Description: NetSuite rejected the Sales Order due to missing or invalid field values.
Resolution: Review NetSuite's error response for specific field validation failures. Common causes include missing required custom fields, invalid tax codes, or misconfigured shipping methods.
Gift Certificate Item Not Found
Gift Certificate SKU not linked to NetSuite item.
Description: The gift card line SKU could not be resolved to a NetSuite Gift Certificate item. The mapping filter checks whether a corresponding gift certificate item exists in NetSuite using the SKU. If the item is not found, the line is not transferred.
Resolution: Ensure the gift card product exists in NetSuite as a Gift Certificate item and that the iPaaS.com product SKU matches the NetSuite item SKU. If necessary, create the item in NetSuite or update the SKU mapping.
Gift Certificate Item Quantity is greater than one
Gift card quantity cannot be greater than 1. NetSuite supports only one gift certificate per transaction line
Description: The gift card line item has a quantity greater than 1. NetSuite supports only one gift certificate per transaction line, so the mapping filter validates the quantity and throws an error if it exceeds 1.
Resolution: Ensure that the gift card product in iPaaS.com is purchased with a quantity of 1 per line item. If multiple gift cards are required, they must be added as separate line items with a quantity of 1.
Gift Certificate Recipient Not Resolved
Recipient email or name could not be retrieved.
Description: The mapping attempts to resolve the gift certificate recipient using a fallback order: CompanyId → CustomerId → EmailAddress. If none of these resolve to a NetSuite customer record, the recipient information may be incomplete.
Resolution: Verify that the CompanyId or CustomerId in iPaaS.com has a valid external ID mapped to NetSuite. If those are not available, ensure the transaction email address matches a customer record in NetSuite.
Gift Certificate Redemption Amount Does Not Match iPaaS Payment Amount
Redemption amount mismatch between NetSuite and iPaaS.
Description: This occurs when the total amount in NetSuite does not match the amount in iPaaS.com. NetSuite applies gift card redemption only to line items present on the document. If any line items are not transferred or taxes are incorrectly mapped, the totals become misaligned. Additionally, if the line item mapping filter excludes items without warning, the discrepancy increases. When the redemption amount is returned to iPaaS.com during gift card polling, it may overwrite the existing balance with an incorrect value.
Resolution: Verify that all line items on the Cash Sale or Sales Order are successfully transferred to NetSuite. Ensure tax mappings are correctly configured and that the same tax amounts are reflected in both systems. Review mapping filters to confirm no items are unintentionally excluded.
Validation and Testing
Validation Rules
The Entity_Id field uses a multi-step fallback (CompanyId → CustomerId → email). Ensure at least one resolution path is valid for each transaction.
Line items are validated against NetSuite before inclusion. The line filter checks that each SKU is linked to a NetSuite item.
Tax override custom fields must exist in NetSuite before they can be populated. The tax rate calculation falls back through line-level TaxPercent → EstimatedTaxAmount → header-level totals.
Fulfillment is only generated when CreateItemFulfillment is true and LocationId_Fulfillment returns a valid location ID with non-zero inventory.
The gift card line SKU corresponds to an existing NetSuite Gift Certificate item before the line is transferred.
Recipient email and name are resolved using a fallback sequence (CompanyId → CustomerId → EmailAddress) to ensure the gift certificate recipient details are populated.
Gift Certificate Existence Validation
The mapping validates that the provided GiftCardId corresponds to an existing gift certificate in NetSuite before processing the redemption.GiftCardId Presence Validation
The mapping verifies that MethodInfo contains a valid, non-empty GiftCardId value before executing the gift certificate validation and mapping.
Validation Checklist
Entity_Id resolves to a valid NetSuite Customer ID for test transactions.
The order status lookup translation table is configured with all expected iPaaS.com statuses.
All line item SKUs are linked to NetSuite items (external IDs set).
Discount item ID matches a valid NetSuite item (update from default "241").
Tax override custom fields exist in NetSuite if tax mappings are active.
Shipping methods in iPaaS.com match configured NetSuite shipping methods.
The payment account lookup translation table is configured.
Gift certificate SKUs are linked to NetSuite gift certificates (if gift card lines are used).
Fulfillment control fields are configured appropriately (default: disabled).
Gift card SKUs in iPaaS.com match NetSuite Gift Certificate item SKUs.
Gift certificate items exist and are active in NetSuite.
Recipient email and name can be resolved through CompanyId, CustomerId, or email lookup.
Ensure that the GiftCardId field exists and is not empty.
Verify that the GiftCardId corresponds to a valid gift certificate record in NetSuite.
Test Scenarios
Scenario 1: Standard Sales Order Update
Sync a qualifying transaction from iPaaS.com with standard line items. Sales Order should be updated in NetSuite with correct header details, addresses, line items, and customer deposit. Verify the memo contains the payment summary and tax information.
Scenario 2: Order with Discount
Sync a transaction with a non-zero DiscountAmount. Verify that the discount item, rate, and amount are applied correctly on the Sales Order.
Scenario 3: Customer Fallback Resolution
Sync a transaction where the CompanyId external ID does not exist. Verify the system falls back to CustomerId and then to email address lookup.
Scenario 4: SKU Not Found (Failure Case)
Sync a transaction with a line item SKU that does not exist in NetSuite. Verify the line is handled according to the filter behavior, and an appropriate error is logged.
Scenario 5: Tax Override Fields
Sync a transaction and verify that custbody_otg_ipaas_tax_rate is calculated correctly from TaxAmount and Subtotal. If line-level tax fields are active, verify the fallback logic (TaxPercent → EstimatedTaxAmount → header totals).
Scenario 6: Recipient Fallback Resolution
Sync a transaction where the CompanyId mapping does not exist. Verify that the system falls back to CustomerId and then to email address lookup to retrieve the recipient information.
Scenario 7: 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 8: 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 9: 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 10: 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 discount item ID ("241") is a template default. Update it to match your NetSuite configuration.
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 line filter for standard lines currently returns true before the exception can execute when a SKU is not found. Carefully review and test this behavior for your implementation.
Ensure dynamic formulas return valid output; null or invalid returns may cause transfer failures.
The ShipMethod_ShippingCarrier is statically set to More. Update this if your configuration uses a different carrier.
Payment filters should be reviewed and updated to transfer only the desired payment types.
Gift certificate lines require a valid NetSuite Gift Certificate item. Standard inventory or non-inventory items cannot be used for gift card lines.
