Edits history of script submission #18915 for ' Create an account allocation run (sage_intacct)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type SageIntacct = {
    	token: string
    }
    /**
     * Create an account allocation run
     * Creates a new account allocation run.
     */
    export async function main(
    	auth: SageIntacct,
    	body: {
    		key?: string
    		id?: string
    		href?: string
    		allocationType?: 'dynamicAllocation' | 'restrictionRelease'
    		asOfDate?: string
    		glPostingDate?: string
    		email?: string
    		state?: 'success' | 'failed' | 'inProgress' | 'queued' | 'partialSuccess'
    		message?: string
    		parent?: { key?: string; id?: string; href?: string }
    		allocationRunType?: 'regular' | 'parent' | 'child'
    		accountAllocation?: { id?: string; key?: string; href?: string }
    		accountAllocationGroup?: {
    			href?: string
    			key?: string
    			id?: string
    			name?: string
    		}
    		dimensions?: {
    			employee?: { key?: string; id?: string; name?: string; href?: string }
    			project?: { key?: string; id?: string; name?: string; href?: string }
    		}
    		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/general-ledger/account-allocation-run`
    	)
    
    	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