ExpenseAllocation - Global
concept brazil Updated Sep 10, 2026 1 min read c_ExpenseAllocationAPI.md
The ExpenseAllocation script include is used by various cost management processes and can also be used for generating custom expense allocation records (fm_expense_allocation) from scripted expense allocation rules.
This script include requires the Cost Management (com.snc.cost_management) plugin.
Parent Topic:Server API reference
ExpenseAllocation - ExpenseAllocation(GlideRecord expense, GlideRecord rule)
Called when you create a new ExpenseAllocation object.
This is not needed if scripting advanced allocation rules. This object is already available as the allocation variable.
| Name | Type | Description |
|---|---|---|
| expense | GlideRecord | GlideRecord identifying the source of the expense. |
| rule | GlideRecord | GlideRecord identifying the rule to use in allocating the expense line. |
| Type | Description |
|---|---|
| ExpenseAllocation object | The ExpenseAllocation object just created. |
JavaScript
var allocation=new ExpenseAllocation(expenseGlideRecord, ruleGlideRecord);ExpenseAllocation - createAllocation(GlideRecord target, Number amount)
Creates an expense allocation (fm_expense_allocation) record referencing the parameters provided during instantiation and this method.
| Name | Type | Description |
|---|---|---|
| target | GlideRecord | GlideRecord target of the allocation, for example a cost center record to allocate an expense to Decimal amount - the amount of the allocation. |
| amount | Number | The amount of the allocation. |
| Type | Description |
|---|---|
| Boolean | True if the expense allocation was successfully created. |
JavaScript
var allocation=new ExpenseAllocation(expenseGlideRecord, ruleGlideRecord);allocation.createAllocation(costCenterGlideRecord, 2345.67);60 lines · 2.7 KB
--- title: ExpenseAllocation - Global description: The ExpenseAllocation script include is used by various cost management processes and can also be used for generating custom expense allocation records \(fm\_expense\_allocation\) from scripted expense allocation rules.Called when you create a new ExpenseAllocation object.Creates an expense allocation \(fm\_expense\_allocation\) record referencing the parameters provided during instantiation and this method. locale: en-US canonical_url: https://www.servicenow.com/docs/r/api-reference/server-api-reference/c\_ExpenseAllocationAPI.html release: brazil product: Server API Reference classification: server-api-reference topic_type: concept last_updated: "2026-09-10" reading_time_minutes: 1 breadcrumb: [Server API reference, API reference, API implementation and reference] --- # ExpenseAllocation- Global The ExpenseAllocation script include is used by various cost management processes and can also be used for generating custom expense allocation records \(fm\_expense\_allocation\) from scripted expense allocation rules. This script include requires the Cost Management \(com.snc.cost\_management\) plugin. **Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/api-reference/server-api-reference/api-server.md) ## ExpenseAllocation - ExpenseAllocation\(GlideRecord expense, GlideRecord rule\) Called when you create a new ExpenseAllocation object. This is not needed if scripting advanced allocation rules. This object is already available as the *allocation* variable. |Name|Type|Description| |----|----|-----------| |expense|GlideRecord|GlideRecord identifying the source of the expense.| |rule|GlideRecord|GlideRecord identifying the rule to use in allocating the expense line.| |Type|Description| |----|-----------| |ExpenseAllocation object|The ExpenseAllocation object just created.| ``` var allocation=new ExpenseAllocation(expenseGlideRecord, ruleGlideRecord); ``` ## ExpenseAllocation - createAllocation\(GlideRecord target, Number amount\) Creates an expense allocation \(fm\_expense\_allocation\) record referencing the parameters provided during instantiation and this method. |Name|Type|Description| |----|----|-----------| |target|GlideRecord|GlideRecord target of the allocation, for example a cost center record to allocate an expense to Decimal amount - the amount of the allocation.| |amount|Number|The amount of the allocation.| |Type|Description| |----|-----------| |Boolean|True if the expense allocation was successfully created.| ``` var allocation=new ExpenseAllocation(expenseGlideRecord, ruleGlideRecord); allocation.createAllocation(costCenterGlideRecord, 2345.67); ```
| title | ExpenseAllocation - Global |
| description | The ExpenseAllocation script include is used by various cost management processes and can also be used for generating custom expense allocation records \(fm\_expense\_allocation\) from scripted expense allocation rules.Called when you create a new ExpenseAllocation object.Creates an expense allocation \(fm\_expense\_allocation\) record referencing the parameters provided during instantiation and this method. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/api-reference/server-api-reference/c\_ExpenseAllocationAPI.html |
| release | brazil |
| product | Server API Reference |
| classification | server-api-reference |
| topic_type | concept |
| last_updated | 2026-09-10 |
| reading_time_minutes | 1 |
| breadcrumb | Server API referenceAPI referenceAPI implementation and reference |