//native
type SageIntacct = {
token: string
}
/**
* Create a task
* Creates a new project task.
`id` is required if document sequencing is not enabled for tasks. If document sequencing is enabled, you can provide an `id` value to use instead of the document sequence value.
Permissions and other requirements
SubscriptionProjects
User typeBusiness, Project Manager
PermissionsAdd Tasks
*/
export async function main(
auth: SageIntacct,
body: {
key?: string
id?: string
name?: string
description?: string
parent?: { key?: string; id?: string; name?: string; href?: string }
project?: {
key?: string
id?: string
name?: string
startDate?: string
endDate?: string
href?: string
}
customer?: { key?: string; id?: string; name?: string; href?: string }
item?: { key?: string; id?: string; name?: string; href?: string }
planned?: { startDate?: string; endDate?: string }
actual?: { startDate?: string; endDate?: string }
duration?: {
planned?: number
plannedBillable?: number
estimated?: number
estimatedBillable?: number
actual?: number
actualBillable?: number
approved?: number
approvedBillable?: number
remaining?: number
}
percentComplete?: number
observedPercentComplete?: number
isMilestone?: false | true
isUtilized?: false | true
isBillable?: false | true
wbsCode?: string
priority?: number
taskStatus?: 'notStarted' | 'planned' | 'inProgress' | 'completed' | 'onHold'
timeType?: { key?: string; id?: string; href?: string }
class?: { key?: string; id?: string; name?: string; href?: string }
attachment?: { key?: string; id?: string; href?: string }
dependentOn?: { key?: string; id?: string; name?: string; href?: string }
productionUnits?: { estimate?: number; description?: string }
root?: { id?: string; key?: string; name?: string; href?: string }
standardTask?: { id?: string; key?: string; name?: string; href?: string }
href?: string
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
} & {}
) {
const url = new URL(`https://api.intacct.com/ia/api/v1/objects/projects/task`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.token
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago