0

Update a contact tax group

by
Published Oct 17, 2025

Updates an existing contact tax group 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 contact tax group
7
 * Updates an existing contact tax group 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
		href?: string
16
		name?: string
17
		groupType?: string
18
		isSystemGenerated?: false | true
19
		isVATEnabled?: false | true
20
		taxSolution?: { key?: string; href?: string; id?: string }
21
		audit?: {
22
			createdDateTime?: string
23
			modifiedDateTime?: string
24
			createdBy?: string
25
			modifiedBy?: string
26
			createdByUser?: { key?: string; id?: string; href?: string }
27
			modifiedByUser?: { key?: string; id?: string; href?: string }
28
		}
29
	} & { id?: {} }
30
) {
31
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/tax/contact-tax-group/${key}`)
32

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