0

Update a price list

by
Published Oct 17, 2025

Updates an existing purchasing price list by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionPurchasing User typeBusiness, Warehouse PermissionsList, View, Edit Price Lists

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

9

10
Permissions and other requirements
11

12
SubscriptionPurchasing
13
User typeBusiness, Warehouse
14
PermissionsList, View, Edit Price Lists
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	key: string,
23
	body: {
24
		key?: string
25
		id?: string
26
		href?: string
27
		appliesTo?: 'purchasing' | 'orderEntry'
28
		startDate?: string
29
		endDate?: string
30
		status?: 'active' | 'inactive'
31
		entity?: { key?: string; id?: string; name?: string; href?: string }
32
	} & { id?: {} }
33
) {
34
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/purchasing/price-list/${key}`)
35

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