0

Create a unit of measure

by
Published Oct 17, 2025

Create one or more custom units of measure within an existing unit of measure group. Permissions and other requirements SubscriptionInventory Control, Order Entry, or Purchasing ConfigurationInventory Control, Order Entry, Purchasing must be enabled for custom units of measure to add, edit, or delete units of measure. User typeBusiness PermissionsList, View, Add Units of Measure

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
7
 * Create one or more custom units of measure within an existing unit of measure group.
8

9

10
Permissions and other requirements
11

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

17

18

19

20
 */
21
export async function main(
22
	auth: SageIntacct,
23
	body: {
24
		key?: string
25
		id?: string
26
		abbreviation?: string
27
		numberOfDecimalPlaces?: number
28
		isBase?: false | true
29
		parent?: { key?: string; id?: string; href?: string }
30
		conversionFactor?: number
31
		href?: string
32
		audit?: {
33
			createdDateTime?: string
34
			modifiedDateTime?: string
35
			createdBy?: string
36
			modifiedBy?: string
37
		}
38
	} & {} & { defaults?: {} }
39
) {
40
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/inventory-control/unit-of-measure`)
41

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