0

Update an account allocation reversal

by
Published Oct 17, 2025

Updates an existing account allocation reversal 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 an account allocation reversal
7
 * Updates an existing account allocation reversal 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
		glAccountAllocation?: { key?: string; id?: string; href?: string }
16
		useSourceAccount?: false | true
17
		glAccount?: { key?: string; id?: string; name?: string; href?: string }
18
		dimensions?: {
19
			class?: { key?: string; name?: string; id?: string; href?: string }
20
			customer?: { key?: string; name?: string; id?: string; href?: string }
21
			employee?: { key?: string; name?: string; id?: string; href?: string }
22
			department?: { key?: string; id?: string; name?: string; href?: string }
23
			location?: { key?: string; id?: string; name?: string; href?: string }
24
			project?: { key?: string; name?: string; id?: string; href?: string }
25
			vendor?: { key?: string; name?: string; id?: string; href?: string }
26
			warehouse?: { key?: string; name?: string; id?: string; href?: string }
27
			item?: { key?: string; name?: string; id?: string; href?: string }
28
			contract?: { key?: string; name?: string; id?: string; href?: string }
29
		}
30
		audit?: {
31
			createdDateTime?: string
32
			modifiedDateTime?: string
33
			createdBy?: string
34
			modifiedBy?: string
35
		}
36
		href?: string
37
	}
38
) {
39
	const url = new URL(
40
		`https://api.intacct.com/ia/api/v1/objects/general-ledger/account-allocation-reverse/${key}`
41
	)
42

43
	const response = await fetch(url, {
44
		method: 'PATCH',
45
		headers: {
46
			'Content-Type': 'application/json',
47
			Authorization: 'Bearer ' + auth.token
48
		},
49
		body: JSON.stringify(body)
50
	})
51
	if (!response.ok) {
52
		const text = await response.text()
53
		throw new Error(`${response.status} ${text}`)
54
	}
55
	return await response.json()
56
}
57