The CustomFieldsSchema object
Custom Fields are platform-defined fields that can be added to existing entities and contain information unique to a business. This feature is currently only supported for Netsuite.
There are three key parts of Rutter's Custom Fields feature:
GET /{entity_type}/custom_fields
outputs a structured schema defining all of the custom fields associated with that entity and the metadata for each custom field. Theentity_type
can be any of the core endpoints for accounting automation workflows, includingbills
,invoices
, andexpenses
.To fetch the values of the custom fields for a given entity, use the
expands=platform_data
query parameter on a GET request. This will output the platform response for a connection and if available, it will also include the custom fields for that entity.To make POST requests with custom fields, simply include the custom field names (key) and values in the POST body request in the
custom_fields
field, alongside any other fields from Rutter's universal data model. Rutter will correctly map all of the relevant to fields to the appropriate objects for write operations. See below for an example, where we will read from the response in the GET call and pass in values in the POST call.
Properties
description
stringThe description of this field.
key
stringThe platform key of this field.
name
stringThe name of this field.
required
booleanWhether this field is required for this entity type.
type
enumThe type of this field.
options
arrayoptions
attributesdefault
nullableThe default value for the field if any.
{
"description": "(More description to come...) Netsuite Type: select",
"key": "custcol_reminderformat",
"name": "Custom Line Item Reminder Format",
"required": false,
"type": "select",
"options": [
{
"text": "Mail",
"value": "1"
},
{
"text": "Email",
"value": "2"
},
{
"text": "SMS",
"value": "3"
},
{
"text": "Phone",
"value": "4"
}
],
"default": null
}
Custom Field Schema
GET /accounting/:entityType/custom_fieldsRequest Parameters
entityType
enumpathThe supported entity types for which we can fetch the custom field schema.
access_token
stringqueryThe access token of the connection.
force_fetch
enumoptionalqueryForce a response even if the underlying connection hasn't finished the initial sync.
platform_fields
enumoptionalqueryInclude fields that are platform defined (or unlocked through a platform defined process) vs. only those that are user defined.
Response Body
custom_fields
objectcustom_fields
attributes{
"custom_fields": {
"entity": [
{
"description": "This is a mandatory field. Netsuite Type: text",
"key": "custbodymandatoryfield",
"name": "Rutter Mandatory Field",
"required": false,
"type": "string",
"options": [],
"default": "Default Value"
},
{
"description": "This is an select field. Netsuite Type: select",
"key": "custbodyemployees",
"name": "Rutter Enum List Record",
"required": false,
"type": "select",
"options": [
{
"text": "Bill",
"value": "4"
},
{
"text": "Rutter Engineering",
"value": "3"
},
{
"text": "Rutter User",
"value": "6"
}
],
"default": null
}
],
"entity.line_items": [
{
"description": "Please check if this is an out going order. Netsuite Type: checkbox",
"key": "custcoloutgoingboolean",
"name": "Outgoing order field",
"required": true,
"type": "boolean",
"options": [],
"default": false
},
{
"description": "Please describe the invoice more. Netsuite Type: text",
"key": "custcoldescription",
"name": "Custom Description",
"required": false,
"type": "string",
"options": [],
"default": null
}
]
}
}
POST w/ Custom Fields
POST /accounting/:entityTypeRequest Parameters
access_token
stringqueryThe access token of the connection.
Request Body
other_entity_fields
stringOther fields for this entity.
custom_fields
objectoptionalCustom fields on the entity. Note: for field type 'select', please use the values from options presented through 'GET /accounting/:entityType/custom_fields' endpoint. For field type 'boolean', please pass in a boolean value.
custom_fields
attributesline_items
arrayline_items
attributesResponse Body
other_entity_fields
stringOther fields for this entity.
line_items
arrayline_items
attributesplatform_data
objectPlatform data for this entity. You can get this on any endpoint by using the platform_data=true
query parameter.
platform_data
attributes{
"other_entity_fields": "Other entity values",
"custom_fields": {
"custom_field_key": "Custom field value"
},
"line_items": [
{
"other_line_item_fields": "Other line item values",
"custom_fields": {
"line_item_custom_field_key": "Line item custom field value"
}
}
]
}
{
"other_entity_fields": "Other entity values",
"line_items": [
{
"other_line_item_fields": "Other line item values"
}
],
"platform_data": {
"custom_field_key": "custom field value",
"other_platform_fields": "Platform fields",
"sublist_key": [
{
"line_item_custom_field_key": "Line item custom field value",
"other_sublist_fields": "Sublist fields"
}
]
}
}
Examples
Here's an example with the entity type invoices
. Note: you can replace invoices
with any of the other supported entity types specified in the "GET Custom Fields Schema" section (Request Parameters > entityType).
1. To get the custom field schema, use GET /accounting/invoices/custom_fields
Here's an example response for the custom field schema endpoint:
{
"custom_fields": {
"invoice": [
{
"key": "custbody_customname",
"name": "Custom Order Name",
"type": "string",
"description": "This is a mandatory field. Netsuite Type: text",
"required": true,
"default": null,
"options": []
},
{
"key": "custbody_secondarycurrency",
"name": "Second Currency",
"type": "select",
"description": "This is a select field. Netsuite Type: select",
"required": false,
"default": null,
"options": [
{
"value": "2",
"text": "British pound"
},
{
"value": "3",
"text": "Canadian Dollar"
},
{
"value": "4",
"text": "Euro"
},
{
"value": "1",
"text": "USA"
}
]
}
],
"invoice.line_items": [
{
"key": "custcol_reminderformat",
"name": "Custom Line Item Reminder Format",
"type": "select",
"description": "Please select the correct reminder format for the customer. Netsuite Type: select",
"required": false,
"default": null,
"options": [
{
"value": "1",
"text": "Mail"
},
{
"value": "2",
"text": "Email"
},
{
"value": "3",
"text": "SMS"
},
{
"value": "4",
"text": "Phone"
}
]
},
{
"key": "custcol_reviewed",
"name": "Custom Review",
"type": "boolean",
"description": "Please click if this order has been manually reviewed. Netsuite Type: checkbox",
"required": false,
"default": false,
"options": []
}
]
}
}
2. To see the custom field values for a certain entity record you could call GET /accounting/invoices?expands=platform_data
The expands=platform_data
query parameter would allow you to see the raw platform response from Netsuite. Here's an example response (note: the custom field key/values):
{
"invoice": {
"id": "11423fb5-e84c-44ec-964f-ab0ffd60e647",
"platform_id": "21156",
"document_number": "50",
"customer_id": "77507585-aeb0-46a2-8667-e56ac1e9126e",
"subsidiary_id": "00b4187f-80d6-4e6e-bca0-4674b5b1bab0",
"issue_date": "2023-01-02T08:00:00.000Z",
"due_date": "2023-01-02T08:00:00.000Z",
"currency_code": "USD",
"account_id": "2267d1db-958f-404e-805a-2751a1199ec2",
"line_items": [
{
"id": null,
"platform_id": "11",
"description": "A Rutter Shirt",
"unit_amount": "2",
"quantity": 1,
"discount_amount": null,
"sub_total": "2",
"tax_amount": null,
"amount": "2",
"discount_percentage": null,
"tax_rate_id": null,
"item_id": "60d96f07-d474-4978-8422-6d5ec479e2c1",
"account_id": "15f844d2-0b04-4b8b-a253-261cf9bbd1fd"
},
{
"id": null,
"platform_id": "5",
"description": "A Second Rutter Shirt",
"unit_amount": "2",
"quantity": 2,
"discount_amount": null,
"sub_total": "4",
"tax_amount": null,
"amount": "4",
"discount_percentage": null,
"tax_rate_id": null,
"item_id": "c012dc49-3d06-4fc3-9ac3-7a883233d01a",
"account_id": "15f844d2-0b04-4b8b-a253-261cf9bbd1fd"
}
],
"status": "open",
"total_discount": null,
"sub_total": "6",
"tax_amount": null,
"total_amount": "6",
"amount_due": "6",
"linked_payments": [],
"memo": null,
"created_at": "2023-06-01T13:56:00.000Z",
"updated_at": "2023-06-01T13:56:00.000Z",
"platform_data": {
"id": "21156",
// omitting other data
"custbody_customname": "Awesome Test Demo Product",
"custbody_secondarycurrency": "3",
"item": [
{
"id": "21156_1",
// omitting other data
"custcol_reminderformat": "2",
"custcol_reviewed": true,
},
{
"id": "21156_4",
// omitting other data
"custcol_reminderformat": "4",
"custcol_reviewed": false,
}
],
}
}
}
3. To post with custom fields, you would call POST /accounting/invoices
with the custom fields information
Here's an example:
{
"invoice": {
"account_id": "6d58a5ba-a8c0-42c5-890d-efd2e659b4d4",
"customer_id": "77507585-aeb0-46a2-8667-e56ac1e9126e",
"due_date": "2023-01-02T02:34:56.000Z",
"issue_date": "2023-01-02T02:34:56.000Z",
"currency_code": "USD",
"memo": "Rutter Demo Invoice with Custom Fields",
"custom_fields": {
"custbody_customname": "Awesome Test Demo Product",
"custbody_secondarycurrency": "3"
},
"line_items": [
{
"total_amount": 2,
"description": "A Rutter Shirt",
"item": {
"id": "60d96f07-d474-4978-8422-6d5ec479e2c1",
"quantity": 1,
"unit_amount": 2
},
"custom_fields": {
"custcol_reminderformat": "2"
}
},
{
"total_amount": 4,
"description": "A Second Rutter Shirt",
"item": {
"id": "c012dc49-3d06-4fc3-9ac3-7a883233d01a",
"quantity": 2,
"unit_amount": 2
},
"custom_fields": {
"custcol_reminderformat": "4",
"custcol_reviewed": true
}
}
]
}
}