0

Update a bin face

by
Published Oct 17, 2025

Updates an existing bin face by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionInventory Control ConfigurationAdvanced workflows is enabled. User typeBusiness PermissionsList, View, Edit Bin Faces

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

9

10
Permissions and other requirements
11

12
SubscriptionInventory Control
13
ConfigurationAdvanced workflows is enabled.
14
User typeBusiness
15
PermissionsList, View, Edit Bin Faces
16

17

18

19

20
 */
21
export async function main(
22
	auth: SageIntacct,
23
	key: string,
24
	body: {
25
		key?: string
26
		id?: string
27
		description?: string
28
		href?: string
29
		audit?: {
30
			createdDateTime?: string
31
			modifiedDateTime?: string
32
			createdBy?: string
33
			modifiedBy?: string
34
		}
35
	} & { id?: {} }
36
) {
37
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/inventory-control/bin-face/${key}`)
38

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