0

Update a billing price list entry line

by
Published Oct 17, 2025

Updates an existing billing price list entry line 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 a billing price list entry line
7
 * Updates an existing billing price list entry line 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
		startDate?: string
17
		flatAmount?: string
18
		variableUnitRate?: string
19
		includedUnits?: string
20
		memo?: string
21
		billingPriceListEntry?: { key?: string; id?: string; href?: string }
22
		tiers?: {
23
			key?: string
24
			id?: string
25
			href?: string
26
			beginQuantity?: string
27
			tierRate?: string
28
			billingPriceListEntryLine?: { key?: string; id?: string; href?: string }
29
			audit?: {
30
				createdDateTime?: string
31
				modifiedDateTime?: string
32
				createdBy?: string
33
				modifiedBy?: string
34
				createdByUser?: { key?: string; id?: string; href?: string }
35
				modifiedByUser?: { key?: string; id?: string; href?: string }
36
			}
37
		}[]
38
		audit?: {
39
			createdDateTime?: string
40
			modifiedDateTime?: string
41
			createdBy?: string
42
			modifiedBy?: string
43
			createdByUser?: { key?: string; id?: string; href?: string }
44
			modifiedByUser?: { key?: string; id?: string; href?: string }
45
		}
46
	}
47
) {
48
	const url = new URL(
49
		`https://api.intacct.com/ia/api/v1/objects/contracts/billing-price-list-entry-line/${key}`
50
	)
51

52
	const response = await fetch(url, {
53
		method: 'PATCH',
54
		headers: {
55
			'Content-Type': 'application/json',
56
			Authorization: 'Bearer ' + auth.token
57
		},
58
		body: JSON.stringify(body)
59
	})
60
	if (!response.ok) {
61
		const text = await response.text()
62
		throw new Error(`${response.status} ${text}`)
63
	}
64
	return await response.json()
65
}
66