0

Create a unit of measure group

by
Published Oct 17, 2025

Creates a new custom unit of measure group. Permissions and other requirements SubscriptionInventory Control, Order Entry, or Purchasing ConfigurationInventory Control, Order Entry, or Purchasing must be enabled for custom units of measure to add, edit, or delete unit of measure groups. User typeBusiness PermissionsList, View, Add Unit of Measure 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 a unit of measure group
7
 * Creates a new custom unit of measure group.
8

9

10
Permissions and other requirements
11

12
SubscriptionInventory Control, Order Entry, or Purchasing
13
ConfigurationInventory Control, Order Entry, or Purchasing must be enabled for custom units of measure to add, edit, or delete unit of measure groups.
14
User typeBusiness
15
PermissionsList, View, Add Unit of Measure groups
16

17

18

19

20
 */
21
export async function main(
22
	auth: SageIntacct,
23
	body: {
24
		key?: string
25
		id?: string
26
		baseUnit?: string
27
		abbreviation?: string
28
		isSystemGenerated?: false | true
29
		defaults?: {
30
			inventory?: { key?: string; id?: string; href?: string }
31
			purchaseOrder?: { key?: string; id?: string; href?: string }
32
			orderEntry?: { key?: string; id?: string; href?: string }
33
		}
34
		unitsOfMeasure?: {
35
			key?: string
36
			id?: string
37
			abbreviation?: string
38
			numberOfDecimalPlaces?: number
39
			isBase?: false | true
40
			parent?: { key?: string; id?: string; href?: string }
41
			conversionFactor?: number
42
			href?: string
43
			audit?: {
44
				createdDateTime?: string
45
				modifiedDateTime?: string
46
				createdBy?: string
47
				modifiedBy?: string
48
			}
49
		}[]
50
		href?: string
51
		audit?: {
52
			createdDateTime?: string
53
			modifiedDateTime?: string
54
			createdBy?: string
55
			modifiedBy?: string
56
		}
57
	} & {} & { defaults?: {} }
58
) {
59
	const url = new URL(
60
		`https://api.intacct.com/ia/api/v1/objects/inventory-control/unit-of-measure-group`
61
	)
62

63
	const response = await fetch(url, {
64
		method: 'POST',
65
		headers: {
66
			'Content-Type': 'application/json',
67
			Authorization: 'Bearer ' + auth.token
68
		},
69
		body: JSON.stringify(body)
70
	})
71
	if (!response.ok) {
72
		const text = await response.text()
73
		throw new Error(`${response.status} ${text}`)
74
	}
75
	return await response.json()
76
}
77