---
title: "Export Configuration"
slug: "export-configuration-2"
updated: 2025-09-15T09:35:59Z
published: 2025-09-15T09:35:59Z
canonical: "knowledge-base.rossum.ai/export-configuration-2"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://knowledge-base.rossum.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Export Configuration

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.

> [!TIP]
> 💡 TIP
> 
> When building the configuration, consult the [methods documentation](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3478008.html#Web-Services-Standard-Operations) and [schema browser](https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2022_2/script/record/vendor.html).

## Customer Payment

```json
{
  "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](/help/docs/formula-fields) page to learn how to create external NetSuite IDs.

```json
{
  "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):

```json
{
  "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:

```json
{
  "_ns_type": {
    "$DATAPOINT_MAPPING$": {
      "schema_id": "document_type",
      "mapping": {
        "tax_credit": "VendorCredit",
        "tax_invoice": "VendorBill"
      }
    }
  }
}
```

Similarly, for line items and so on:

```json
{
  "_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_`:

```json
{
  "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:

```json
{
  "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:

```json
{
  "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](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3458179.html).

### 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](/help/docs/serverless-functions).

**`original_file_name` serverless function**

```python
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()
```

```json
{
  "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)

> [!WARNING]
> 🚧 WORK IN PROGRESS 🚧
> 
> We're still working on this part and would love to hear your thoughts! Feel free to [share your feedback](https://github.com/rossumai/university/discussions) or [submit a pull request](https://github.com/rossumai/university/pulls). 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:

```json
{
  "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"
      }
    }
  }
}
```

> [!WARNING]
> 💬 YOUR FEEDBACK MATTERS!
> 
> Help us keep this page accurate and useful. Select **Yes** or **No** below, then use the feedback form to propose a correction, ask for clarification, or request a new article.
