0

Create an item cross reference

by
Published Oct 17, 2025

Creates a new item cross reference. Permissions and other requirements SubscriptionInventory Control, Order Entry User typeBusiness PermissionsAdd, List, View Item cross references

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 item cross reference
7
 * Creates a new item cross reference.
8

9

10
Permissions and other requirements
11

12
SubscriptionInventory Control, Order Entry
13
User typeBusiness
14
PermissionsAdd, List, View Item cross references
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
		referenceType?: 'customer' | 'vendor' | 'substitute' | 'upgrade' | 'downgrade' | 'complement'
27
		itemAliasId?: string
28
		itemAliasDescription?: string
29
		unitOfMeasure?: { key?: string; id?: string; href?: string }
30
		referenceTypeContext?: 'internal' | 'external'
31
		alternateItem?: { key?: string; id?: string; name?: string; href?: string }
32
		customer?: { key?: string; id?: string; name?: string; href?: string }
33
		item?: { key?: string; id?: string; name?: string; href?: string }
34
		vendor?: { key?: string; id?: string; name?: string; href?: string }
35
		audit?: {
36
			createdDateTime?: string
37
			modifiedDateTime?: string
38
			createdBy?: string
39
			modifiedBy?: string
40
		}
41
	} & {}
42
) {
43
	const url = new URL(
44
		`https://api.intacct.com/ia/api/v1/objects/inventory-control/item-cross-reference`
45
	)
46

47
	const response = await fetch(url, {
48
		method: 'POST',
49
		headers: {
50
			'Content-Type': 'application/json',
51
			Authorization: 'Bearer ' + auth.token
52
		},
53
		body: JSON.stringify(body)
54
	})
55
	if (!response.ok) {
56
		const text = await response.text()
57
		throw new Error(`${response.status} ${text}`)
58
	}
59
	return await response.json()
60
}
61