//native
type SageIntacct = {
token: string
}
/**
* Create a project
* Creates a new project.
`id` is required if document sequencing is not enabled for projects in the company. 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 Projects
*/
export async function main(
auth: SageIntacct,
body: {
key?: string
id?: string
name?: string
description?: string
projectCurrency?: string
category?: 'contract' | 'capitalized' | 'internalNonBillable' | 'internalBillable'
projectStatus?: {
key?: string
id?: string
disableGenerateInvoice?: false | true
disablePurchasingAPEntry?: false | true
disableExpenseEntry?: false | true
disableTimesheetEntry?: false | true
href?: string
}
startDate?: string
endDate?: string
budget?: {
billingAmount?: string
budgetedDuration?: string
budgetedCost?: string
}
glBudget?: { key?: string; id?: string; href?: string }
contractAmount?: string
actualAmount?: string
progress?: {
estimatedDuration?: string
actualDuration?: string
approvedDuration?: string
remainingDuration?: string
percentComplete?: string
observedPercentComplete?: string
}
billingType?: 'timeAndMaterial' | 'fixedFee' | 'fixedFeeAndExpenses'
salesOrderNumber?: string
purchaseOrderNumber?: string
purchaseOrderAmount?: string
purchaseQuoteNumber?: string
salesforceKey?: string
documentNumber?: string
parent?: { key?: string; id?: string; name?: string; href?: string }
invoiceWithParent?: false | true
rootProject?: { key?: string; id?: string; name?: string; href?: string }
wipScheduleProject?: {
key?: string
id?: string
name?: string
href?: string
}
excludeFromWIPSchedule?: false | true
customer?: { key?: string; id?: string; name?: string; href?: string }
salesContact?: { key?: string; id?: string; name?: string; href?: string }
projectType?: { key?: string; id?: string; href?: string }
manager?: { key?: string; id?: string; name?: string; href?: string }
department?: { key?: string; id?: string; name?: string; href?: string }
location?: { key?: string; id?: string; name?: string; href?: string }
paymentTerm?: { key?: string; id?: string; href?: string }
customerUser?: { key?: string; id?: string; href?: string }
class?: { key?: string; id?: string; name?: string; href?: string }
userRestrictions?: 'systemDefault' | 'anyUser' | 'projectUsers' | 'projectTaskUsers'
isBillableEmployeeExpense?: false | true
isBillablePurchasingAPExpense?: false | true
ratesAndPricing?: {
laborPricing?: 'billingRate' | 'costPlusFee'
laborMarkup?: string
expensePricing?: 'billingRate' | 'costPlusFee'
expenseMarkup?: string
defaultRate?: string
purchasingAPPricing?: 'costPlusFee'
}
contacts?: {
primary?: { key?: string; id?: string; href?: string }
billTo?: { key?: string; id?: string; href?: string }
shipTo?: { key?: string; id?: string; href?: string }
}
invoiceMessage?: string
invoiceCurrency?: string
billingOverMax?: 'doNothing' | 'issueAWarningMessage' | 'preventBilling'
excludeExpenses?: false | true
contract?: { key?: string; id?: string; href?: string }
attachment?: { key?: string; id?: string; href?: string }
grant?: {
aln?: string
fundedProjectName?: string
agency?: string
payer?: 'federal' | 'thirdParty'
otherId?: string
assistanceType?: 'cash' | 'nonCash'
revenueRestriction?: 'purpose' | 'time' | 'NA'
restrictionExpiry?: string
restrictionExpirationDate?: string
isTimeSatisfactionScheduled?: false | true
}
scopeDetails?: {
scope?: string
inclusions?: string
exclusions?: string
terms?: string
}
scheduleDetails?: {
scheduledStartDate?: string
scheduledCompletionDate?: string
actualStartDate?: string
actualCompletionDate?: string
revisedCompletionDate?: string
substantialCompletionDate?: string
noticeToProceedDate?: string
responseDueDate?: string
executedOnDate?: string
scheduleImpactNotes?: string
}
multiEntityLocation?: {
key?: string
id?: string
name?: string
href?: string
}
status?: 'active' | 'inactive'
entity?: { key?: string; id?: string; name?: 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/project`)
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