Netsuit Export Configuration
Reference configuration examples for exporting extracted data to NetSuite, covering common use cases with notes on adjustments required for specific NetSuite instance configurations.
This page showcases the most common configurations. The final configuration depends heavily on the NetSuite instance configuration and might need to be adjusted as needed.
When building the configuration, consult the methods documentation and schema browser.
Customer Payment
{
"run_async": false,
"export_configs": [
{
"payload": [
{
"method_args": [
{
"_ns_type": "CustomerPayment",
"arAcct": {
"type": "account",
"_ns_type": "RecordRef",
"internalId": 123
},
"account": {
"type": "account",
"_ns_type": "RecordRef",
"internalId": "@{ns_account}"
},
"payment": "@{amount_due}",
"customer": {
"type": "customer",
"_ns_type": "RecordRef",
"internalId": "@{sender_match}"
},
"tranDate": {
"$IF_SCHEMA_ID$": {
"mapping": {
"$DATAPOINT_VALUE$": {
"schema_id": "date_issue",
"value_type": "iso_datetime"
}
},
"schema_id": "date_issue"
}
},
"applyList": {
"apply": {
"$FOR_EACH_SCHEMA_ID$": {
"mapping": {
"doc": "@{ns_item_internal_id}",
"due": "@{item_amount_to_apply}",
"apply": true,
"total": "@{item_amount_to_apply}",
"amount": "@{item_amount_to_apply}",
"refNum": "@{item_invoice_number}",
"_ns_type": "CustomerPaymentApply"
},
"schema_id": "line_item"
}
},
"_ns_type": "CustomerPaymentApplyList"
},
"undepFunds": false,
"paymentOption": {
"type": "paymentMethod",
"_ns_type": "RecordRef",
"internalId": "@{ns_payment_option}"
}
}
],
"method_name": "add"
}
]
}
],
"netsuite_settings": {
"account": "XXX_SB1",
"wsdl_url": "https://XXX-sb1.suitetalk.api.netsuite.com/wsdl/v2024_1_0/netsuite.wsdl",
"service_url": "https://XXX-sb1.suitetalk.api.netsuite.com/services/NetSuitePort_2024_1",
"concurrency_limit": 4,
"service_binding_name": "{urn:platform_2024_1.webservices.netsuite.com}NetSuiteBinding"
}
}
Vendor Bills (Invoices)
The following shows a Vendor Bill export that (perhaps with some small tweaks) should work for most of the cases.
Visit Rossum Formulas page to learn how to create external NetSuite IDs.
{
"run_async": false,
"netsuite_settings": {
"account": "XXX_SB1", // Case sensitive!
"concurrency_limit": 4,
"wsdl_url": "https://XXX-sb1.suitetalk.api.netsuite.com/wsdl/v2024_1_0/netsuite.wsdl",
"service_url": "https://XXX-sb1.suitetalk.api.netsuite.com/services/NetSuitePort_2024_1",
"service_binding_name": "{urn:platform_2024_1.webservices.netsuite.com}NetSuiteBinding"
},
"export_configs": [
{
"payload": {
"method_name": "upsert",
"method_args": [
{
"_ns_type": "VendorBill",
"approvalStatus": {
"_ns_type": "RecordRef",
"internalId": "2" // 1 = Pending, 2 = Approved
},
"class": {
"type": "classification",
"_ns_type": "RecordRef",
"internalId": "@{ns_class_match}"
},
"customForm": {
"type": "customRecord",
"_ns_type": "RecordRef",
"internalId": "@{ns_customForm}"
},
"currency": {
"type": "currency",
"_ns_type": "RecordRef",
"internalId": "@{ns_currency_match}"
},
"department": {
"type": "department",
"_ns_type": "RecordRef",
"internalId": "@{ns_department_match}"
},
"dueDate": {
"$IF_SCHEMA_ID$": {
"schema_id": "date_due",
"mapping": {
"$DATAPOINT_VALUE$": {
"schema_id": "date_due",
"value_type": "iso_datetime"
}
}
}
},
"entity": {
"type": "vendor",
"_ns_type": "RecordRef",
"internalId": "@{ns_vendor_match}"
},
"externalId": "@{ns_externalId}",
"subsidiary": {
"type": "subsidiary",
"_ns_type": "RecordRef",
"internalId": "@{ns_subsidiary_match}"
},
"tranId": "@{document_id_normalized}",
"tranDate": {
"$IF_SCHEMA_ID$": {
"schema_id": "date_issue",
"mapping": {
"$DATAPOINT_VALUE$": {
"schema_id": "date_issue",
"value_type": "iso_datetime"
}
}
}
},
"itemList": {
"_ns_type": "VendorBillItemList",
"item": {
"$FOR_EACH_SCHEMA_ID$": {
"schema_id": "line_item",
"mapping": {
"_ns_type": "VendorBillItem",
"description": "@{item_description}",
"item": {
"type": "inventoryItem",
"_ns_type": "RecordRef",
"internalId": "@{item_ns_item_match}"
},
"rate": "@{item_amount_base}",
"location": {
"type": "location",
"_ns_type": "RecordRef",
"internalId": "@{item_ns_location_match}"
},
"quantity": "@{item_quantity}",
"taxCode": {
"type": "taxType",
"_ns_type": "RecordRef",
"internalId": "@{item_po_item_taxCode_match}"
}
}
}
}
}
}
]
}
}
]
}
Linking Vendor Bills with Purchase Orders
To connect Vendor Bills with Purchase Orders, it is necessary to set both
orderDoc and orderLine on line-items level
(showing only relevant parts of the export config):
{
"export_configs": [
{
"payload": {
"method_name": "upsert",
"method_args": [
{
"tranId": "@{document_id}",
"itemList": {
"_ns_type": "VendorBillItemList",
"item": {
"$FOR_EACH_SCHEMA_ID$": {
"schema_id": "line_item",
"mapping": {
// …
"_ns_type": "VendorBillItem",
"orderDoc": "@{item_po_match}", // PO internal ID
"orderLine": "@{item_po_item_line_match}" // Relevant line-item number from PO (itemList.item.line)
// …
}
}
}
}
// …
}
]
}
}
]
}
Note that the combination of Purchase Order and line item no. can appear only once in the payload. In case it appears twice on the invoice then it's necessary to group the line items before exporting.
Conditional configuration using $DATAPOINT_MAPPING$
You can leverage JSON Templating to introduce conditions into the configuration. For example, in this example, we are changing document (NS) type based on the detected document type:
{
"_ns_type": {
"$DATAPOINT_MAPPING$": {
"schema_id": "document_type",
"mapping": {
"tax_credit": "VendorCredit",
"tax_invoice": "VendorBill"
}
}
}
}
Similarly, for line items and so on:
{
"_ns_type": {
"$DATAPOINT_MAPPING$": {
"schema_id": "document_type",
"mapping": {
"tax_credit": "VendorCreditItemList",
"tax_invoice": "VendorBillItemList"
}
}
}
}
Consider implementing this $DATAPOINT_MAPPING$ condition higher
in the configuration tree and duplicating the whole sections to avoid too
complex conditional configurations.
Working with custom fields
Custom fields on header level are usually prefixed by
custbody_:
{
"customFieldList": {
"_ns_type": "CustomFieldList",
"customField": [
{
"value": "@{amount_total}",
"_ns_type": "StringCustomFieldRef",
"scriptId": "custbody_captured_total_amount"
}
// …
]
}
}
Custom fields can also be added conditionally using special
$IF_SCHEMA_ID$ syntax:
{
"customFieldList": {
"_ns_type": "CustomFieldList",
"customField": [
{
"$IF_SCHEMA_ID$": {
"mapping": {
"value": "@{amount_total}",
"_ns_type": "StringCustomFieldRef",
"scriptId": "custbody_captured_total_amount"
},
"schema_id": "amount_total"
}
}
// …
]
}
}
Line item custom fields are usually prefixed by custcol_. They
also must be nested in the item list:
{
"itemList": {
"item": {
"customFieldList": {
"_ns_type": "CustomFieldList",
"customField": [
{
"value": "@{ns_custcol_some_field}",
"_ns_type": "StringCustomFieldRef",
"scriptId": "custcol_some_field"
}
// …
]
}
}
}
}
Custom fields are represented by the type CustomFieldRef, which
is an abstract type. The table below contains a list of concrete custom field
types that extend the CustomFieldRef type:
| JSON Mapping Type | Custom Field Type in UI |
|---|---|
LongCustomFieldRef
|
Integer |
DoubleCustomFieldRef
|
Decimal Number |
BooleanCustomFieldRef
|
Check Box |
StringCustomFieldRef
|
Free-Form Text, Text Area, Phone Number, E-mail Address, Hyperlink, Rich Text |
DateCustomFieldRef
|
Date, Time of Day, or Date/Time (both in one field) |
SelectCustomFieldRef
|
List/Record, Document |
MultiSelectCustomFieldRef
|
Multiple Select |
For more information, please visit this link.
Using NetSuite File Cabinet (pipeline_context)
You can reference earlier export stages by accessing
pipeline_context variable. In the following example, we use
pipeline_context for attaching file uploaded to the
NetSuite File Cabinet. Note that the configuration uses
original_file_name variable from the Get document
information serverless function.
original_file_name serverless function
from txscript import TxScript
def rossum_hook_request_handler(payload):
t = TxScript.from_payload(payload)
# Original file name:
t.field.original_file_name = payload.get("document").get("original_file_name")
return t.hook_response()
{
"export_configs": [
{
"payload": [
{
// … upsert VendorBill here as usual
},
{
"method_name": "add",
"method_args": [
{
"name": "@{original_file_name}",
"folder": {
"type": "folder",
"_ns_type": "RecordRef",
"internalId": "123456"
},
"content": {
"$GET_DOCUMENT_CONTENT$": {}
},
"_ns_type": "File",
"attachFrom": "_web",
"description": "VendorBill processed by Rossum"
}
]
},
{
"method_name": "attach",
"method_args": [
{
"_ns_type": "AttachBasicReference",
"attachTo": {
"type": "vendorBill",
"_ns_type": "RecordRef",
"internalId": "{pipeline_context[0].internal_id}"
},
"attachedRecord": {
"type": "file",
"_ns_type": "RecordRef",
"internalId": "{pipeline_context[1].internal_id}"
}
}
]
}
]
}
]
}
Notice also the highlighted $GET_DOCUMENT_CONTENT$ which returns
the content of the original file.
Vendor Credits (credit notes)
We're still working on this part and would love to hear your thoughts! Feel free to share your feedback or submit a pull request. Thank you!
Linking Vendor Credits with Vendor Bills
Vendor credits can be linked to vendor bills via applyList
configuration. Note that the credits can be applied only "Open" vendor bills and
always to VB line 0. In this example, we apply the whole credit
note value to the specified vendor bill:
{
"applyList": {
"$IF_DATAPOINT_VALUE$": {
"schema_id": "ns_status_match",
"value": "Open",
"mapping": {
"apply": {
"doc": "@{ns_internalId_match}",
"line": "0",
"apply": true,
"amount": "@{amount_total_normalized}",
"_ns_type": "VendorCreditApply"
},
"_ns_type": "VendorCreditApplyList"
}
}
}
}