0

Create an MEA price list entry

by
Published Oct 17, 2025

Creates a new MEA price list entry.

Script sage_intacct Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type SageIntacct = {
3
	token: string
4
}
5
/**
6
 * Create an MEA price list entry
7
 * Creates a new MEA price list entry.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		href?: string
15
		meaPriceList?: { key?: string; id?: string; href?: string }
16
		fairValueCategory?: { key?: string; id?: string; href?: string }
17
		item?: { key?: string; id?: string; name?: string; href?: string }
18
		currency?: {
19
			exchangeRateDate?: string
20
			exchangeRateTypeId?: string
21
			exchangeRate?: number
22
			baseCurrency?: string
23
			txnCurrency?: string
24
		}
25
		priceType?: 'amount' | 'percent' | 'priceRange' | 'noFairValue'
26
		calculatePercentageBasedOn?: 'extendedFairValuePrice' | 'extendedContractLinePrice'
27
		usePriceRange?: false | true
28
		priceRangeVarianceType?: 'amount' | 'percent'
29
		priceRuleOutsideRange?: 'fairValue' | 'nearestBoundary'
30
		lines?: {
31
			key?: string
32
			id?: string
33
			href?: string
34
			meaPriceListEntry?: { key?: string; id?: string; href?: string }
35
			startDate?: string
36
			amountOrPercent?: string
37
			markDown?: string
38
			markUp?: string
39
			lowerLimit?: string
40
			upperLimit?: string
41
			memo?: string
42
			audit?: {
43
				createdDateTime?: string
44
				modifiedDateTime?: string
45
				createdBy?: string
46
				modifiedBy?: string
47
				createdByUser?: { key?: string; id?: string; href?: string }
48
				modifiedByUser?: { key?: string; id?: string; href?: string }
49
			}
50
		}[]
51
		audit?: {
52
			createdDateTime?: string
53
			modifiedDateTime?: string
54
			createdBy?: string
55
			modifiedBy?: string
56
			createdByUser?: { key?: string; id?: string; href?: string }
57
			modifiedByUser?: { key?: string; id?: string; href?: string }
58
		}
59
		status?: 'active' | 'inactive'
60
	} & { currency: {} }
61
) {
62
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/contracts/mea-price-list-entry`)
63

64
	const response = await fetch(url, {
65
		method: 'POST',
66
		headers: {
67
			'Content-Type': 'application/json',
68
			Authorization: 'Bearer ' + auth.token
69
		},
70
		body: JSON.stringify(body)
71
	})
72
	if (!response.ok) {
73
		const text = await response.text()
74
		throw new Error(`${response.status} ${text}`)
75
	}
76
	return await response.json()
77
}
78