0

Update an item GL group

by
Published Oct 17, 2025

Updates an existing item GL group by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionInventory Control User typeBusiness, Project Manager, Employee, Warehouse PermissionsAdd, Edit Item GL groups

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 item GL group
7
 * Updates an existing item GL group by setting field values. Any fields not provided remain unchanged.
8

9

10
Permissions and other requirements
11

12
SubscriptionInventory Control
13
User typeBusiness, Project Manager, Employee, Warehouse
14
PermissionsAdd, Edit Item GL groups
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	key: string,
23
	body: {
24
		key?: string
25
		id?: string
26
		deferredRevenueGLAccount?: {
27
			key?: string
28
			id?: string
29
			name?: string
30
			href?: string
31
		}
32
		defaultRevenueRecognitionTemplate?: {
33
			key?: string
34
			id?: string
35
			href?: string
36
		}
37
		isSystemGenerated?: false | true
38
		href?: string
39
		audit?: {
40
			createdDateTime?: string
41
			modifiedDateTime?: string
42
			createdBy?: string
43
			modifiedBy?: string
44
		}
45
		entity?: { key?: string; id?: string; name?: string; href?: string }
46
	} & {} & { id?: {} }
47
) {
48
	const url = new URL(
49
		`https://api.intacct.com/ia/api/v1/objects/inventory-control/item-gl-group/${key}`
50
	)
51

52
	const response = await fetch(url, {
53
		method: 'PATCH',
54
		headers: {
55
			'Content-Type': 'application/json',
56
			Authorization: 'Bearer ' + auth.token
57
		},
58
		body: JSON.stringify(body)
59
	})
60
	if (!response.ok) {
61
		const text = await response.text()
62
		throw new Error(`${response.status} ${text}`)
63
	}
64
	return await response.json()
65
}
66