0

Update an affiliate entity group

by
Published Oct 17, 2025

Updates an existing affiliate entity group by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionCompany User typeBusiness PermissionsList, View, Edit Affiliate Entity Group

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

9

10
Permissions and other requirements
11

12
SubscriptionCompany
13
User typeBusiness
14
PermissionsList, View, Edit Affiliate Entity Group
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
		name?: string
28
		description?: string
29
		groupType?: 'all' | 'specific'
30
		memberFilter?: {
31
			object?: string
32
			filters?:
33
				| { $eq?: {} }
34
				| { $ne?: {} }
35
				| { $lt?: {} }
36
				| { $lte?: {} }
37
				| { $gt?: {} }
38
				| { $gte?: {} }
39
				| { $in?: {} }
40
				| { $notIn?: {} }
41
				| { $contains?: {} }
42
				| { $notContains?: {} }
43
				| { $startsWith?: {} }
44
				| { $notStartsWith?: {} }
45
				| { $endsWith?: {} }
46
				| { $notEndsWith?: {} }[]
47
			filterExpression?: string
48
			orderBy?: {}[]
49
			size?: number
50
		} & {}
51
		groupMembers?: {
52
			key?: string
53
			id?: string
54
			href?: string
55
			name?: string
56
		}[]
57
		isDimensionStructure?: false | true
58
		audit?: {
59
			createdDateTime?: string
60
			modifiedDateTime?: string
61
			createdBy?: string
62
			modifiedBy?: string
63
		}
64
	} & { id?: {} }
65
) {
66
	const url = new URL(
67
		`https://api.intacct.com/ia/api/v1/objects/company-config/affiliate-entity-group/${key}`
68
	)
69

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