0

Create an item group

by
Published Oct 17, 2025

Creates a new item group.

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 group
7
 * Creates a new item group.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		href?: string
15
		name?: string
16
		description?: string
17
		groupType?: 'all' | 'specific'
18
		memberFilter?: {
19
			object?: string
20
			filters?:
21
				| { $eq?: {} }
22
				| { $ne?: {} }
23
				| { $lt?: {} }
24
				| { $lte?: {} }
25
				| { $gt?: {} }
26
				| { $gte?: {} }
27
				| { $in?: {} }
28
				| { $notIn?: {} }
29
				| { $contains?: {} }
30
				| { $notContains?: {} }
31
				| { $startsWith?: {} }
32
				| { $notStartsWith?: {} }
33
				| { $endsWith?: {} }
34
				| { $notEndsWith?: {} }[]
35
			filterExpression?: string
36
			orderBy?: {}[]
37
			size?: number
38
		} & {}
39
		groupMembers?: {
40
			key?: string
41
			id?: string
42
			href?: string
43
			itemGroup?: { key?: string; id?: string; href?: string }
44
			item?: {
45
				key?: string
46
				id?: string
47
				name?: string
48
				status?: 'active' | 'inactive'
49
				href?: string
50
			}
51
			sortOrder?: number
52
			audit?: {
53
				createdDateTime?: string
54
				modifiedDateTime?: string
55
				createdBy?: string
56
				modifiedBy?: string
57
			}
58
		}[]
59
		glAccountGroup?: { key?: string; id?: string; href?: string }
60
		createDimensionComponents?: false | true
61
		audit?: {
62
			createdDateTime?: string
63
			modifiedDateTime?: string
64
			createdBy?: string
65
			modifiedBy?: string
66
		}
67
		entity?: { key?: string; id?: string; name?: string; href?: string }
68
	} & {}
69
) {
70
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/inventory-control/item-group`)
71

72
	const response = await fetch(url, {
73
		method: 'POST',
74
		headers: {
75
			'Content-Type': 'application/json',
76
			Authorization: 'Bearer ' + auth.token
77
		},
78
		body: JSON.stringify(body)
79
	})
80
	if (!response.ok) {
81
		const text = await response.text()
82
		throw new Error(`${response.status} ${text}`)
83
	}
84
	return await response.json()
85
}
86