0

Update a bank transaction rule set

by
Published Oct 17, 2025

Updates an existing bank transaction rule set by setting field values. Any fields not provided remain unchanged. Updating a rule set affects matches for incoming transactions going forward for every associated account that uses the rule set. Updating a rule set does not affect transactions that have already been matched. Permissions and other requirements SubscriptionCash Management User typeBusiness PermissionsList, Edit Bank transaction rule sets

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 bank transaction rule set
7
 * Updates an existing bank transaction rule set by setting field values. Any fields not provided remain unchanged. Updating a rule set affects matches for incoming transactions going forward for every associated account that uses the rule set. Updating a rule set does not affect transactions that have already been matched.
8

9

10
Permissions and other requirements
11

12
SubscriptionCash Management
13
User typeBusiness
14
PermissionsList, Edit Bank transaction rule sets
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
		ruleSetId?: string
28
		name?: string
29
		description?: string
30
		accountType?: 'bank' | 'creditcard'
31
		numberOfAccounts?: number
32
		numberOfRules?: number
33
		location?: { key?: string; id?: string; href?: string }
34
		status?: 'active' | 'inactive'
35
		rules?: {
36
			key?: string
37
			id?: string
38
			ruleOrder?: number
39
			bankTxnRule?: {
40
				id?: string
41
				key?: string
42
				href?: string
43
				ruleId?: string
44
				name?: string
45
				ruleType?: 'match' | 'create'
46
			}
47
			bankTxnRuleSet?: { id?: string; key?: string; href?: string }
48
			audit?: {
49
				createdDateTime?: string
50
				modifiedDateTime?: string
51
				createdBy?: string
52
				modifiedBy?: string
53
			}
54
		}[]
55
		audit?: {
56
			createdDateTime?: string
57
			modifiedDateTime?: string
58
			createdBy?: string
59
			modifiedBy?: string
60
		}
61
		entity?: { key?: string; id?: string; name?: string; href?: string }
62
	} & { id?: {} }
63
) {
64
	const url = new URL(
65
		`https://api.intacct.com/ia/api/v1/objects/cash-management/bank-txn-rule-set/${key}`
66
	)
67

68
	const response = await fetch(url, {
69
		method: 'PATCH',
70
		headers: {
71
			'Content-Type': 'application/json',
72
			Authorization: 'Bearer ' + auth.token
73
		},
74
		body: JSON.stringify(body)
75
	})
76
	if (!response.ok) {
77
		const text = await response.text()
78
		throw new Error(`${response.status} ${text}`)
79
	}
80
	return await response.json()
81
}
82