0

Update an MEA price list

by
Published Oct 17, 2025

Update an existing MEA price list by setting field values. Any fields not provided remain unchanged.

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 an MEA price list
7
 * Update an existing MEA price list by setting field values. Any fields not provided remain unchanged.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	key: string,
12
	body: {
13
		key?: string
14
		id?: string
15
		href?: string
16
		description?: string
17
		isDefault?: false | true
18
		status?: 'active' | 'inactive'
19
		audit?: {
20
			createdDateTime?: string
21
			modifiedDateTime?: string
22
			createdBy?: string
23
			modifiedBy?: string
24
			createdByUser?: { key?: string; id?: string; href?: string }
25
			modifiedByUser?: { key?: string; id?: string; href?: string }
26
		}
27
	} & { id?: {} }
28
) {
29
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/contracts/mea-price-list/${key}`)
30

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