0

Update a project status

by
Published Oct 17, 2025

Updates an existing project status by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionProjects Basic Project Tracking and General Ledger (enable the Projects dimension) User typeBusiness, Project Manager PermissionsEdit Project Status

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

9

10
Permissions and other requirements
11

12
SubscriptionProjects Basic Project Tracking and General Ledger (enable the Projects dimension)
13
User typeBusiness, Project Manager
14
PermissionsEdit Project Status
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
		description?: string
27
		disableTimesheetEntry?: false | true
28
		disableExpenseEntry?: false | true
29
		disablePurchasingAPEntry?: false | true
30
		disableGenerateInvoice?: false | true
31
		status?: 'active' | 'inactive'
32
		entity?: { key?: string; id?: string; name?: string; href?: string }
33
		audit?: {
34
			createdDateTime?: string
35
			modifiedDateTime?: string
36
			createdBy?: string
37
			modifiedBy?: string
38
		}
39
		href?: string
40
	} & { id?: {} }
41
) {
42
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/projects/project-status/${key}`)
43

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