0

Update a change request type

by
Published Oct 17, 2025

Updates an existing change request type by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionConstruction, Project Costing and Billing User typeBusiness, Project Manager PermissionsList, View, Edit Change requests

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

9

10
Permissions and other requirements
11

12
SubscriptionConstruction, Project Costing and Billing
13
User typeBusiness, Project Manager
14
PermissionsList, View, Edit Change requests
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
		status?: 'active' | 'inactive'
28
		audit?: {
29
			createdDateTime?: string
30
			modifiedDateTime?: string
31
			createdBy?: string
32
			modifiedBy?: string
33
		}
34
	} & { id?: {} }
35
) {
36
	const url = new URL(
37
		`https://api.intacct.com/ia/api/v1/objects/construction/change-request-type/${key}`
38
	)
39

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