0

Create a standard task

by
Published Oct 17, 2025

Creates a new standard task.

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 standard task
7
 * Creates a new standard task.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		href?: string
15
		name?: string
16
		description?: string
17
		productionUnitDescription?: string
18
		status?: 'active' | 'inactive'
19
		item?: { key?: string; id?: string; name?: string; href?: string }
20
		isBillable?: false | true
21
		isMilestone?: false | true
22
		isUtilized?: false | true
23
		priority?: number
24
		timeType?: { key?: string; name?: string; href?: string }
25
		wbsCode?: string
26
		parent?: { key?: string; id?: string; name?: string; href?: string }
27
		class?: { id?: string; key?: string; name?: string; href?: string }
28
		standardCostTypes?: { key?: string; id?: string; href?: string }[]
29
		audit?: {
30
			createdDateTime?: string
31
			modifiedDateTime?: string
32
			createdBy?: string
33
			modifiedBy?: string
34
		}
35
	} & {}
36
) {
37
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/construction/standard-task`)
38

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