0

Update a project estimate type

by
Published Oct 17, 2025

Updates an existing project estimate type by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionProject Costing and Billing User typeBusiness, Employee, Project Manager PermissionsEdit Estimate Types

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

9

10
Permissions and other requirements
11

12
SubscriptionProject Costing and Billing
13
User typeBusiness, Employee, Project Manager
14
PermissionsEdit Estimate Types
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
		workflowTypes?:
28
			| 'original'
29
			| 'revision'
30
			| 'forecast'
31
			| 'approvedChange'
32
			| 'pendingChange'
33
			| 'other'[]
34
		estimateCategory?:
35
			| 'currentEstimate'
36
			| 'originalEstimate'
37
			| 'currentForecastAtCompletion'
38
			| 'historicalForecastAtCompletion'
39
			| 'futureForecastAtCompletion'
40
			| 'currentForecastToCompletion'
41
			| 'historicalForecastToCompletion'
42
			| 'futureForecastToCompletion'
43
		status?: 'active' | 'inactive'
44
		audit?: {
45
			createdDateTime?: string
46
			modifiedDateTime?: string
47
			createdBy?: string
48
			modifiedBy?: string
49
		}
50
	} & { id?: {} }
51
) {
52
	const url = new URL(
53
		`https://api.intacct.com/ia/api/v1/objects/construction/project-estimate-type/${key}`
54
	)
55

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