---
sourceDocument: Australia IT Service Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/it-service-management

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia IT Service Management

ft:clusterId :

    - itsm

bundleId :

    - itsm

workflow :

    - Technology


---

# Use a scripted allocation

# Use a scripted allocation {#ariaid-title1}

Release version: Australia  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read  
Scripted allocations define custom allocation amounts and targets by executing a
script.

## Before you begin

Role required: admin, financial_mgmt_admin, or financial_mgmt_user

## About this task

You can use scripted allocations to perform any of the following actions.

* Allocate an expense to all cost centers based on the current head count in the cost center.
* Query usage data to determine the allocation amount to assign to a target.
* Track the business users that are consuming business services.
{#t_UseAScriptedAllocation__ul_qz4_zft_qq}

## Procedure

1. Navigate to AllCostsAdministrationExpense Allocation Rules.
2. Select an expense allocation rule.
3. Select the Advanced check box.
4. Use the following concepts to build the script  
   * Query for target records and data to use for calculating the allocation amount.
   * Create allocation records using the ExpenseAllocation API.

   {#t_UseAScriptedAllocation__ul_y2f_ggt_qq}  
   The following variables are available during the script processing:
   * allocation: expense allocation object used to create allocations.
   * expense: GlideRecord for the expense_line that is being processed.
   * rule: GlideRecord for this rule.
   {#t_UseAScriptedAllocation__ul_i1v_kgt_qq}

   To create an allocation record, use the allocation object already
   instantiated in the script scope:  

       allocation.createAllocation(targetGlideRecord, amount);

**Related concepts**   

* [Automatic expense line creation](https://servicenow-prod.fluidtopics.net/bPJVL6oUKmsnjiv9B7jY3w "You can automatically create expense lines to facilitate the accurate reporting of expenses.")  
**Related tasks**   

* [Create an allocation rule](https://servicenow-prod.fluidtopics.net/OQ4nrdwHA21y3WRiIdF_lw "Expense allocation rules enable you to associate expenses with an item, such as a user, group, or department.")
* [Create expense lines manually](https://servicenow-prod.fluidtopics.net/DxNM~h8HTxFTrMiwzIgQ1A "You can create expense lines at a single level or in a hierarchy to better organize expense information.")
* [Delete an expense line](https://servicenow-prod.fluidtopics.net/0Skwc7owJszSboUNZgrVww "Deleting an expense line also deletes all expense allocations that were generated from the expense line.")
* [Create a sample allocation rule](https://servicenow-prod.fluidtopics.net/fmh6A2yZ_XhyEuLYajiNVQ "You can create a sample expense allocation rule that allocates the cost of an incident to the department of the caller.")

*[\>]: and then


