0

Update a Purchasing tax schedule

by
Published Oct 17, 2025

Updates an existing Purchasing tax schedule by setting field values. Any fields not provided remain unchanged.

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
 * Update a Purchasing tax schedule
7
 * Updates an existing Purchasing tax schedule by setting field values. Any fields not provided remain unchanged.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	key: string,
12
	body: {
13
		key?: string
14
		id?: string
15
		name?: string
16
		href?: string
17
		status?: 'active' | 'inactive'
18
		description?: string
19
		isSystemGenerated?: false | true
20
		lines?: {
21
			key?: string
22
			id?: string
23
			effectiveDate?: string
24
			href?: string
25
			taxSchedule?: { key?: string; id?: string; name?: string; href?: string }
26
			taxDetail?: { key?: string; id?: string; href?: string }
27
		}[]
28
		taxSolution?: { key?: string; id?: string; href?: string }
29
	} & { id?: {} }
30
) {
31
	const url = new URL(
32
		`https://api.intacct.com/ia/api/v1/objects/tax/purchasing-tax-schedule/${key}`
33
	)
34

35
	const response = await fetch(url, {
36
		method: 'PATCH',
37
		headers: {
38
			'Content-Type': 'application/json',
39
			Authorization: 'Bearer ' + auth.token
40
		},
41
		body: JSON.stringify(body)
42
	})
43
	if (!response.ok) {
44
		const text = await response.text()
45
		throw new Error(`${response.status} ${text}`)
46
	}
47
	return await response.json()
48
}
49