0

Create a WIP setup

by
Published Oct 17, 2025

Creates a new WIP setup. Permissions and other requirements SubscriptionConstruction User typeBusiness user with admin privileges PermissionsAdd WIP Setups

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 WIP setup
7
 * Creates a new WIP setup.
8

9

10
Permissions and other requirements
11

12
SubscriptionConstruction
13
User typeBusiness user with admin privileges
14
PermissionsAdd WIP Setups
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	body: {
23
		key?: string
24
		id?: string
25
		postingJournal?: string
26
		reconcileMethod?: 'autoReverse' | 'autoReverseBegin' | 'autoReverseEnd' | 'netChange'
27
		autoCreateNextPeriod?: false | true
28
		wipCostBreakdownLevel?: 'wipScheduleProject' | 'project' | 'costCode' | 'costCodeAndCostType'
29
		allowGroupCostCodes?: false | true
30
		wipSetupAccounts?: {
31
			key?: string
32
			id?: string
33
			wipAccountType?:
34
				| 'cost'
35
				| 'revenue'
36
				| 'overbilling'
37
				| 'underbilling'
38
				| 'offset'
39
				| 'underbillingOffset'
40
				| 'overbillingOffset'
41
			accountNumber?: string
42
			accountTitle?: string
43
			href?: string
44
			wipSetup?: { key?: string; id?: string; href?: string }
45
			audit?: {
46
				createdDateTime?: string
47
				modifiedDateTime?: string
48
				createdBy?: string
49
				modifiedBy?: string
50
			}
51
		}[]
52
		href?: string
53
		audit?: {
54
			createdDateTime?: string
55
			modifiedDateTime?: string
56
			createdBy?: string
57
			modifiedBy?: string
58
		}
59
	} & {}
60
) {
61
	const url = new URL(
62
		`https://api.intacct.com/ia/api/v1/objects/construction-forecasting/wip-setup`
63
	)
64

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