0

Update an Accounts Receivable or direct GL account detail object

by
Published Oct 17, 2025

Updates an existing transaction definition Accounts Receivable or direct GL account detail object by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionOrder Entry User typeBusiness, Employee, Project Manager, Warehouse PermissionsList, View, Edit transaction definitions

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 Accounts Receivable or direct GL account detail object
7
 * Updates an existing transaction definition Accounts Receivable or direct GL account detail object by setting field values. Any fields not provided remain unchanged.
8

9

10
Permissions and other requirements
11

12
SubscriptionOrder Entry
13
User typeBusiness, Employee, Project Manager, Warehouse
14
PermissionsList, View, Edit transaction definitions
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
		isOffset?: false | true
28
		txnType?: 'debit' | 'credit'
29
		moduleType?: 'subledger' | 'inventory' | 'additional'
30
		lineNumber?: number
31
		glAccount?: { key?: string; id?: string; href?: string }
32
		location?: { href?: string; key?: string; id?: string }
33
		department?: { href?: string; key?: string; id?: string }
34
		itemGLGroup?: { href?: string; key?: string; id?: string }
35
		warehouse?: { href?: string; key?: string; id?: string }
36
		customerGLGroup?: { id?: string }
37
		status?: 'active' | 'inactive'
38
		'order-entry-txn-definition'?: { key?: string; id?: string; href?: string }
39
	} & { id?: {} }
40
) {
41
	const url = new URL(
42
		`https://api.intacct.com/ia/api/v1/objects/order-entry/txn-definition-ar-direct-gl-detail/${key}`
43
	)
44

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