//native
type SageIntacct = {
token: string
}
/**
* Create a revenue recognition template
* Creates a new revenue recognition template.
*/
export async function main(
auth: SageIntacct,
body: {
key?: string
id?: string
href?: string
description?: string
useStandard?: false | true
schedulePeriod?: 'daily' | 'monthly' | 'quarterly' | 'semiAnnually' | 'annually'
postingDay?:
| 'daily'
| '1'
| '2'
| '3'
| '4'
| '5'
| '6'
| '7'
| '8'
| '9'
| '10'
| '11'
| '12'
| '13'
| '14'
| '15'
| '16'
| '17'
| '18'
| '19'
| '20'
| '21'
| '22'
| '23'
| '24'
| '25'
| '26'
| '27'
| '28'
| '29'
| '30'
| '31'
| 'endOfPeriod'
recognitionTerm?: 'fixedPeriod' | 'contractTerm' | 'project'
resumeOption?: 'catchUp' | 'walkforward'
totalPeriods?: string
recognitionMethod?:
| 'straightLine'
| 'straightLine,prorateExactDays'
| 'straightLine,percentAllocation'
| 'straightLine,percentAllocation,endOfPeriod'
| 'exactDaysPerPeriod,prorateDays'
| 'exactDaysPerPeriod,prorateDays,endOfPeriod'
| 'percentCompleted'
| 'milestone'
| 'custom'
recognitionStartDate?: 'transactionDate' | 'userSpecified'
postingMethod?: 'automatic' | 'manual'
latestVersion?: string
milestoneSource?: 'project' | 'manual'
calculation?: {
source?: 'project' | 'task'
basedOn?:
| 'estimatedHours'
| 'plannedHours'
| 'budgetedHours'
| 'budgetedCostFromGL'
| 'budgetedCostFromSummary'
| 'observed%Completed'
}
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/accounts-receivable/revenue-recognition-template`
)
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