Document sequences

Use document sequencing to generate new IDs automatically for common transactions and records, such as new customers, vendors, invoices, and more. For example, you can create a document sequence for invoices. This new sequence automatically creates a new ID, such as 'INV-0100' and increments the number each time a new invoice is created.

List document sequences

get/objects/company-config/document-sequence

Returns up to 100 document sequences from the collection with a key, ID, and link for each sequence. This operation is mostly for use in testing; use the query service to find document sequences that meet certain criteria and to specify the properties that are returned.

SecurityOAuth2
Responses
200

OK

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": [
    • {
      • "key": "37",
      • "id": "BOA_ACH_BatchNo",
      • "href": "/objects/company-config/document-sequence/37"
      },
    • {
      • "key": "27",
      • "id": "Purchase Order",
      • "href": "/objects/company-config/document-sequence/27"
      }
    ],
  • "ia::meta": {
    • "totalCount": 2,
    • "start": 1,
    • "pageSize": 100,
    • "next": null,
    • "previous": null
    }
}

Create a document sequence

post/objects/company-config/document-sequence

Creates a new document sequence.

SecurityOAuth2
Request
Request Body schema: application/json

Document sequence to create

id
required
string

Document sequence ID

Example: "Vendors"
printTitle
string

Print title

Example: "Vendors"
type
string
Default: "numeric"

Numeric or alpha sequence. Alpha sequences are currently only available for use with Cash Management, or French companies.

Enum: "alpha" "numeric"
Example: "numeric"
fixedLength
string

Fixed length, up to 16 characters (numeric sequence will be padded with zeros and alpha sequence will be padded with a's)

Example: "16"
fixedPrefix
string

Fixed prefix

Example: "INV"
prefixSeparator
string

Prefix separator

Example: "-"
fixedSuffix
string

Fixed suffix

Example: "COMPANY"
suffixSeparator
string

Suffix separator

Example: "-"
startingNumber
integer

Starting number

Example: 1
endingNumber
integer

Ending number

Example: 100
nextNumber
integer

Next number

Example: 1
startingSequence
string

Starting sequence

Example: "a"
endingSequence
string

Ending sequence

Example: "zzz"
nextSequence
string

Next sequence

Example: "a"
whenModified
string <date-time>

When updated

Example: "2014-01-08T11:28:12Z"
object

Use the roollover configuration to generate IDs for documents meant to take effect in a specific fiscal year.

isEnabled
boolean
Default: false

Set to true in order to enable the sequence rollover by fiscal years. When rollover is enabled for a document sequence then a restart of the document sequence is initiated for each fiscal year. Use the fiscalYears to configure the next number or alpha values used to generate sequences for the fiscal years. If the configuration for a fiscal year is missing then it is automatically generated by the system when the first sequence is generated. When the system generates a configuration the next number or alpha values are taken over from the base start values.

Example: false
enabledDate
string <date>

Read only value indicating the date when the rollover configuration was enabled for the first time.

Example: "2021-01-23"
fiscalYearAffixPosition
string
Default: "none"

Configures the option that the fiscal year is appended to the document sequence generated by the function service for that fiscal year.

** Valid values **

  • none Do not append the fiscal year nor the rollover separator to the document sequence.
  • prefix Append the fiscal year togetwher with the rollover prefix separator as a prefix to the document sequence.
  • suffix Append the fiscal year togetwher with the rollover suffix separator as a suffix to the document sequence.
Enum: "none" "prefix" "suffix"
Example: "prefix"
separator
string

Rollover separator used when the rollover affix mode is set to prefix or suffix

Example: "-"
Array of objects

Fiscal years rollover configuration holds the next number or alpha values used to generate sequences for the fiscal years.

Array
fiscalYear
integer

Fiscal year

Example: 2024
nextNumber
integer

Next number used to generate sequences for the fiscal year when the sequence type is numeric

Example: 1
nextSequence
string

Next sequence used to generate sequences for the fiscal year when the sequence type is alpha

Example: "a"
status
string
Default: "active"

Object status. Active objects are fully functional. Inactive objects are essentially hidden and cannot be used or referenced.

Enum: "active" "inactive"
Example: "active"
Responses
201

Created

400

Bad Request

Request samples
application/json
{
  • "id": "Vendor Invoice",
  • "printTitle": "Vendor Invoice",
  • "type": "numeric",
  • "fixedPrefix": "P",
  • "fixedSuffix": "S",
  • "prefixSeparator": "-",
  • "suffixSeparator": "-",
  • "startingNumber": 1,
  • "endingNumber": null,
  • "nextNumber": 1,
  • "fixedLength": "4",
  • "rollover": {
    • "isEnabled": true,
    • "fiscalYearAffixPosition": "prefix",
    • "separator": "-",
    • "fiscalYears": [
      • {
        },
      • {
        }
      ]
    }
}
Response samples
application/json
{
  • "ia::result": {
    • "key": "107",
    • "id": "Vendor Invoice",
    • "href": "/objects/company-config/document-sequence/107"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Get a document sequence

get/objects/company-config/document-sequence/{key}

Returns detailed information for a particular document sequence.

SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the document sequence.

Responses
200

OK

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": {
    • "key": "107",
    • "id": "BOA_ACH_BatchNo",
    • "printTitle": "BOA_ACH_BatchNo",
    • "fixedPrefix": "P",
    • "fixedSuffix": "S",
    • "prefixSeparator": "-",
    • "suffixSeparator": "-",
    • "startingNumber": 1,
    • "endingNumber": null,
    • "nextNumber": 1,
    • "whenModified": "2014-01-08T11:28:12Z",
    • "fixedLength": null,
    • "status": "active",
    • "type": "numeric",
    • "startingSequence": null,
    • "endingSequence": null,
    • "nextSequence": null,
    • "rollover": {
      • "isEnabled": true,
      • "enabledDate": "2024-02-14",
      • "fiscalYearAffixPosition": "prefix",
      • "separator": "-"
      },
    • "audit": {
      • "createdDateTime": "2014-01-08T11:28:12Z",
      • "modifiedDateTime": "2014-01-08T11:28:12Z",
      • "createdBy": "109",
      • "modifiedBy": "109"
      },
    • "fiscalYears": [
      • {
        },
      • {
        }
      ],
    • "href": "/objects/company-config/document-sequence/107"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Update a document sequence

patch/objects/company-config/document-sequence/{key}

Updates an existing document sequence by setting field values. Any fields not provided remain unchanged.

SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the document sequence.

Request Body schema: application/json
printTitle
string

Print title

Example: "Vendors"
type
string
Default: "numeric"

Numeric or alpha sequence. Alpha sequences are currently only available for use with Cash Management, or French companies.

Enum: "alpha" "numeric"
Example: "numeric"
fixedLength
string

Fixed length, up to 16 characters (numeric sequence will be padded with zeros and alpha sequence will be padded with a's)

Example: "16"
fixedPrefix
string

Fixed prefix

Example: "INV"
prefixSeparator
string

Prefix separator

Example: "-"
fixedSuffix
string

Fixed suffix

Example: "COMPANY"
suffixSeparator
string

Suffix separator

Example: "-"
startingNumber
integer

Starting number

Example: 1
endingNumber
integer

Ending number

Example: 100
nextNumber
integer

Next number

Example: 1
startingSequence
string

Starting sequence

Example: "a"
endingSequence
string

Ending sequence

Example: "zzz"
nextSequence
string

Next sequence

Example: "a"
whenModified
string <date-time>

When updated

Example: "2014-01-08T11:28:12Z"
object

Use the roollover configuration to generate IDs for documents meant to take effect in a specific fiscal year.

isEnabled
boolean
Default: false

Set to true in order to enable the sequence rollover by fiscal years. When rollover is enabled for a document sequence then a restart of the document sequence is initiated for each fiscal year. Use the fiscalYears to configure the next number or alpha values used to generate sequences for the fiscal years. If the configuration for a fiscal year is missing then it is automatically generated by the system when the first sequence is generated. When the system generates a configuration the next number or alpha values are taken over from the base start values.

Example: false
enabledDate
string <date>

Read only value indicating the date when the rollover configuration was enabled for the first time.

Example: "2021-01-23"
fiscalYearAffixPosition
string
Default: "none"

Configures the option that the fiscal year is appended to the document sequence generated by the function service for that fiscal year.

** Valid values **

  • none Do not append the fiscal year nor the rollover separator to the document sequence.
  • prefix Append the fiscal year togetwher with the rollover prefix separator as a prefix to the document sequence.
  • suffix Append the fiscal year togetwher with the rollover suffix separator as a suffix to the document sequence.
Enum: "none" "prefix" "suffix"
Example: "prefix"
separator
string

Rollover separator used when the rollover affix mode is set to prefix or suffix

Example: "-"
Array of objects

Fiscal years rollover configuration holds the next number or alpha values used to generate sequences for the fiscal years.

Array
fiscalYear
integer

Fiscal year

Example: 2024
nextNumber
integer

Next number used to generate sequences for the fiscal year when the sequence type is numeric

Example: 1
nextSequence
string

Next sequence used to generate sequences for the fiscal year when the sequence type is alpha

Example: "a"
status
string
Default: "active"

Object status. Active objects are fully functional. Inactive objects are essentially hidden and cannot be used or referenced.

Enum: "active" "inactive"
Example: "active"
Responses
200

OK

400

Bad Request

Request samples
application/json
{
  • "prefixSeparator": "-"
}
Response samples
application/json
{
  • "ia::result": {
    • "key": "107",
    • "id": "BOA_ACH_BatchNo",
    • "href": "/objects/company-config/document-sequence/107"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Delete a document sequence

delete/objects/company-config/document-sequence/{key}

Deletes a document sequence.

SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the document sequence.

Responses
204

No Content

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": {
    • "ia::error": {
      • "code": "invalidRequest",
      • "message": "Payload contains errors",
      • "supportId": "sQrM9%7EYdh5oDEWVb80mrn9xuHjoAAAABBQ",
      • "errorId": "REST-1064",
      • "additionalInfo": {
        },
      • "details": [
        ]
      },
    • "ia::meta": {
      • "totalCount": 3,
      • "totalSuccess": 2,
      • "totalError": 1
      }
    },
  • "ia::error": {
    • "code": "invalidRequest",
    • "message": "Malformed URL",
    • "supportId": "sQrM9%7EYdh5oDEWVb80mrn9xuHjoAAAABBQ",
    • "details": [
      • {
        }
      ]
    }
}

Query document sequences

post/services/core/query

Queries an object for filtered data.

SecurityOAuth2
Request
Request Body schema: application/json
object
string

Object type to query, in the form <application-name>/<object name>. For custom objects use platform-apps/nsp::<object-name>.

Example: "company-config/document-sequence"
fields
Array of strings

List of fields to include in the response. Can be any combination of these:

  • The name of a field in the object that you are querying, such as id.

  • The name of a field in a related object, using the form relatedObjectName.fieldName, such as vendor.id.

  • The result of an aggregate function run against the values in the returned objects. Use the form function:fieldName, such as min:startDate to return the earliest starting date. Valid function names are:

    • count
    • avg
    • sum
    • min
    • max
  • The result of an aggregate function run against the values in related objects, using the form function:relatedObjectName.fieldName, such as max:vendor.creditLimit. The same functions are supported as for object fields.

Example: ["key","id","max:vendor.creditLimit"]
Array of equal (object) or not equal (object) or less than (object) or (less than or equal (object)) or greater than (object) or (greater than or equal (object)) or in (object) or not in (object) or between (object) or not between (object) or contains (object) or does not contain (object) or starts with (object) or does not start with (object) or ends with (object) or does not end with (object)

Filter conditions to select the objects to return based on their field values. You use operators and conditions to build your filter, such as {"$eq":{"status":"active"}} to select objects in which status is equal to "active".

Example: [{"$eq":{"status":"active"}},{"$gt":{"totalDue":"1000"}},{"$contains":{"name":"Acme"}}]
Array
Any of:

Field value must be equal to this specified value.

For date fields, you can use these macro values that are relative to the current date or the asOfDate in filterParameters, if set:

  • today
  • currentWeek
  • currentMonth
  • currentQuarter
  • currentYear
  • yesterday
  • lastWeek
  • priorMonth
  • priorQuarter
  • priorYear

These are most useful for queries that you want to save and use repeatedly, such as for views or reports. Just change the asOfDate each time to retrieve the same data set for different time periods.

For example, {"eq":{"postingDate":"priorYear"}}.

object

The field name and value to be compared with object values.

Example: {"status":"active"}
filterExpression
string
Default: "and"

Logical operators to apply when there are multiple filter conditions. The conditions in the filters array are implicitly numbered starting at 1. Supports and, or, and grouping with parentheses.

Shortcuts:

  • and by itself means that all conditions must be true.
  • or by itself means that at least one condition must be true.
Example: "(1 and 2) or 3"
object

Pre-defined filter options.

asOfDate
string <date>

The "as of" date to use with any relative date comparisons in filters. For example, if asOfDate is set to "2022-04-01" then priorMonth will be "03".

The current date is used if asOfDate is not set.

Example: "2022-04-01"
includeHierarchyFields
boolean
Default: false

Set to true to include hierarchical structure information with each object in the response.

Example: false
caseSensitiveComparison
boolean
Default: true

Queries are case-sensitive by default. Set to false to ignore case in a query.

Example: true
includePrivate
boolean
Default: false

By default, in a multi-entity company, queries from the top-level entity do not access data in private entities. Set includePrivate to true if you want to query data in private entities.

Example: false
Array of objects

Set the order of the results by specifying field names to sort by and whether they should be in ascending or descending order.

Example: [{"totalDue":"asc"},{"lastPaymentMadeDate":"desc"}]
Array
property name*
additional property
string
Enum: "asc" "desc"
start
integer

First record of the result set to include in the response.

Example: 1
size
integer

Number of records to include in the response.

Example: 100
Responses
200

OK

400

Bad Request

Request samples
application/json
{
  • "object": "company-config/document-sequence",
  • "filters": [
    • {
      • "$eq": {
        }
      }
    ],
  • "fields": [
    • "key",
    • "id",
    • "nextNumber",
    • "href"
    ],
  • "orderBy": [
    • {
      • "id": "asc"
      }
    ]
}
Response samples
application/json
{
  • "ia::result": [
    • {
      • "key": "11",
      • "id": "ACH Batch No.",
      • "nextNumber": 1,
      • "href": "/objects/company-config/document-sequence/11"
      },
    • {
      • "key": "6",
      • "id": "ActivationNo",
      • "nextNumber": 654,
      • "href": "/objects/company-config/document-sequence/6"
      },
    • {
      • "key": "18",
      • "id": "Adjustment Decrease",
      • "nextNumber": 6,
      • "href": "/objects/company-config/document-sequence/18"
      },
    • {
      • "key": "19",
      • "id": "Adjustment Increase",
      • "nextNumber": 22,
      • "href": "/objects/company-config/document-sequence/19"
      }
    ],
  • "ia::meta": {
    • "totalCount": 4,
    • "start": 1,
    • "pageSize": 100,
    • "next": null,
    • "previous": null
    }
}