0

Create a customer item cross reference

by
Published Oct 17, 2025

Creates a new customer item cross reference.

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 a customer item cross reference
7
 * Creates a new customer item cross reference.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		href?: string
15
		customer?: { key?: string; id?: string; name?: string; href?: string }
16
		item?: { key?: string; id?: string; name?: string; href?: string }
17
		referenceType?: 'customer'
18
		itemAliasId?: string
19
		itemAliasDescription?: string
20
		unit?: string
21
		referenceTypeContext?: 'internal' | 'external'
22
		audit?: {
23
			createdDateTime?: string
24
			modifiedDateTime?: string
25
			createdBy?: string
26
			modifiedBy?: string
27
		}
28
	} & {}
29
) {
30
	const url = new URL(
31
		`https://api.intacct.com/ia/api/v1/objects/accounts-receivable/customer-item-cross-reference`
32
	)
33

34
	const response = await fetch(url, {
35
		method: 'POST',
36
		headers: {
37
			'Content-Type': 'application/json',
38
			Authorization: 'Bearer ' + auth.token
39
		},
40
		body: JSON.stringify(body)
41
	})
42
	if (!response.ok) {
43
		const text = await response.text()
44
		throw new Error(`${response.status} ${text}`)
45
	}
46
	return await response.json()
47
}
48