0

Create an affiliate entity group

by
Published Oct 17, 2025

Creates a new affiliate entity group. Permissions and other requirements SubscriptionCompany User typeBusiness PermissionsList, View, Add Affiliate Entity Groups

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
 * Create an affiliate entity group
7
 * Creates a new affiliate entity group.
8

9

10
Permissions and other requirements
11

12
SubscriptionCompany
13
User typeBusiness
14
PermissionsList, View, Add Affiliate Entity Groups
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	body: {
23
		key?: string
24
		id?: string
25
		href?: string
26
		name?: string
27
		description?: string
28
		groupType?: 'all' | 'specific'
29
		memberFilter?: {
30
			object?: string
31
			filters?:
32
				| { $eq?: {} }
33
				| { $ne?: {} }
34
				| { $lt?: {} }
35
				| { $lte?: {} }
36
				| { $gt?: {} }
37
				| { $gte?: {} }
38
				| { $in?: {} }
39
				| { $notIn?: {} }
40
				| { $contains?: {} }
41
				| { $notContains?: {} }
42
				| { $startsWith?: {} }
43
				| { $notStartsWith?: {} }
44
				| { $endsWith?: {} }
45
				| { $notEndsWith?: {} }[]
46
			filterExpression?: string
47
			orderBy?: {}[]
48
			size?: number
49
		} & {}
50
		groupMembers?: {
51
			key?: string
52
			id?: string
53
			href?: string
54
			name?: string
55
		}[]
56
		isDimensionStructure?: false | true
57
		audit?: {
58
			createdDateTime?: string
59
			modifiedDateTime?: string
60
			createdBy?: string
61
			modifiedBy?: string
62
		}
63
	} & {}
64
) {
65
	const url = new URL(
66
		`https://api.intacct.com/ia/api/v1/objects/company-config/affiliate-entity-group`
67
	)
68

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