0

Update a price schedule

by
Published Oct 17, 2025

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

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

9

10
Permissions and other requirements
11

12
SubscriptionPurchasing
13
Configurationnull
14
User typeBusiness
15
PermissionsList, View, Edit Price Schedules
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
		href?: string
28
		description?: string
29
		priceList?: { key?: string; id?: string; href?: string }
30
		discountPercent?: string
31
		audit?: {
32
			createdDateTime?: string
33
			modifiedDateTime?: string
34
			createdBy?: string
35
			modifiedBy?: string
36
		} & { createdBy?: string; modifiedBy?: string }
37
		status?: 'active' | 'inactive'
38
		entity?: { key?: string; id?: string; name?: string; href?: string }
39
	} & { id?: {} }
40
) {
41
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/purchasing/price-schedule/${key}`)
42

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