0

Create an item GL group

by
Published Oct 17, 2025

Creates a new item GL group. 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
 * Create an item GL group
7
 * Creates a new item GL group.
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
	body: {
23
		key?: string
24
		id?: string
25
		deferredRevenueGLAccount?: {
26
			key?: string
27
			id?: string
28
			name?: string
29
			href?: string
30
		}
31
		defaultRevenueRecognitionTemplate?: {
32
			key?: string
33
			id?: string
34
			href?: string
35
		}
36
		isSystemGenerated?: false | true
37
		href?: string
38
		audit?: {
39
			createdDateTime?: string
40
			modifiedDateTime?: string
41
			createdBy?: string
42
			modifiedBy?: string
43
		}
44
		entity?: { key?: string; id?: string; name?: string; href?: string }
45
	} & {}
46
) {
47
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/inventory-control/item-gl-group`)
48

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