//native
type SageIntacct = {
token: string
}
/**
* Update a WIP setup
* Updates an existing WIP setup object by setting the field values. Any fields not provided remain unchanged.
Permissions and other requirements
SubscriptionConstruction
User typeBusiness user with admin privileges
PermissionsEdit WIP Setups
*/
export async function main(
auth: SageIntacct,
key: string,
body: {
key?: string
id?: string
postingJournal?: string
reconcileMethod?: 'autoReverse' | 'autoReverseBegin' | 'autoReverseEnd' | 'netChange'
autoCreateNextPeriod?: false | true
wipCostBreakdownLevel?: 'wipScheduleProject' | 'project' | 'costCode' | 'costCodeAndCostType'
allowGroupCostCodes?: false | true
wipSetupAccounts?: {
key?: string
id?: string
wipAccountType?:
| 'cost'
| 'revenue'
| 'overbilling'
| 'underbilling'
| 'offset'
| 'underbillingOffset'
| 'overbillingOffset'
accountNumber?: string
accountTitle?: string
href?: string
wipSetup?: { key?: string; id?: string; href?: string }
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
}[]
href?: string
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
}
) {
const url = new URL(
`https://api.intacct.com/ia/api/v1/objects/construction-forecasting/wip-setup/${key}`
)
const response = await fetch(url, {
method: 'PATCH',
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