0

Get next sequence value

by
Published Oct 17, 2025

Increments and returns the next sequence value for a specified document sequence, optionally for a specified fiscal year.

Script sage_intacct Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type SageIntacct = {
3
	token: string
4
}
5
/**
6
 * Get next sequence value
7
 * Increments and returns the next sequence value for a specified document sequence, optionally for a specified fiscal year.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: { key?: string; id?: string; fiscalYear?: number } & {}
12
) {
13
	const url = new URL(
14
		`https://api.intacct.com/ia/api/v1/services/company-config/document-sequence/get-next-sequence`
15
	)
16

17
	const response = await fetch(url, {
18
		method: 'POST',
19
		headers: {
20
			'Content-Type': 'application/json',
21
			Authorization: 'Bearer ' + auth.token
22
		},
23
		body: JSON.stringify(body)
24
	})
25
	if (!response.ok) {
26
		const text = await response.text()
27
		throw new Error(`${response.status} ${text}`)
28
	}
29
	return await response.json()
30
}
31