0

Update an account allocation basis

by
Published Oct 17, 2025

Updates an existing account allocation basis object by setting field values. Any fields not provided remain unchanged.

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 account allocation basis
7
 * Updates an existing account allocation basis object by setting field values. Any fields not provided remain unchanged.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	key: string,
12
	body: {
13
		key?: string
14
		id?: string
15
		glAccountAllocation?: { key?: string; id?: string; href?: string }
16
		accumulation?: 'activity' | 'endingBalance'
17
		timePeriod?: { key?: string; id?: string; href?: string }
18
		reportingBook?: 'accrual' | 'cash'
19
		allocationMethod?: 'dynamicRelativeAccountFinancial' | 'dynamicRelativeAccountStatistical'
20
		skipNegative?: false | true
21
		useAmountsFrom?: 'mainReportingBookAndAlternateBooks' | 'alternateBooksOnly'
22
		glAccountGroup?: { key?: string; id?: string; href?: string }
23
		dimensions?: {
24
			location?: { key?: string; id?: string; name?: string; href?: string }
25
			department?: { key?: string; id?: string; name?: string; href?: string }
26
			employee?: { key?: string; id?: string; name?: string; href?: string }
27
			project?: { key?: string; id?: string; name?: string; href?: string }
28
			customer?: { key?: string; id?: string; name?: string; href?: string }
29
			vendor?: { key?: string; id?: string; name?: string; href?: string }
30
			item?: { key?: string; id?: string; name?: string; href?: string }
31
			warehouse?: { key?: string; id?: string; name?: string; href?: string }
32
			class?: { key?: string; id?: string; name?: string; href?: string }
33
			task?: { id?: string; key?: string; name?: string; href?: string }
34
			costType?: { id?: string; key?: string; name?: string; href?: string }
35
			asset?: { id?: string; key?: string; name?: string; href?: string }
36
			contract?: { id?: string; key?: string; name?: string; href?: string }
37
			affiliateEntity?: {
38
				key?: string
39
				id?: string
40
				href?: string
41
				name?: string
42
			}
43
		} & {
44
			location?: { key?: string; id?: string; name?: string; href?: string }
45
			department?: { key?: string; id?: string; name?: string; href?: string }
46
		}
47
		audit?: {
48
			createdDateTime?: string
49
			modifiedDateTime?: string
50
			createdBy?: string
51
			modifiedBy?: string
52
		}
53
		href?: string
54
	}
55
) {
56
	const url = new URL(
57
		`https://api.intacct.com/ia/api/v1/objects/general-ledger/account-allocation-basis/${key}`
58
	)
59

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