0

Update an employee expense summary

by
Published Oct 17, 2025

Updates an existing employee expense summary by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionTime & Expenses User typeBusiness, Employee PermissionsList, View, Edit Expense summaries

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

9

10
Permissions and other requirements
11

12
SubscriptionTime & Expenses
13
User typeBusiness, Employee
14
PermissionsList, View, Edit Expense summaries
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
		name?: string
27
		postingDate?: string
28
		totalAmount?: string
29
		state?: 'open' | 'closed'
30
		recordType?: 'expense' | 'adjustment' | 'reimbursement'
31
		summaryCreationType?: 'system' | 'manual'
32
		bankAccount?: { key?: string; id?: string; href?: string }
33
		preventGLPosting?: false | true
34
		href?: string
35
		status?: 'active' | 'inactive'
36
		entity?: { key?: string; id?: string; name?: string; href?: string }
37
	}
38
) {
39
	const url = new URL(
40
		`https://api.intacct.com/ia/api/v1/objects/expenses/employee-expense-summary/${key}`
41
	)
42

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