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

 Release :

    - australia

ft:locale :

    - de-DE

ft:publication_title :

    - Australia IT Service Management

ft:clusterId :

    - itsm

bundleId :

    - itsm

workflow :

    - Technology


---

# Use a scripted allocation

# Use a scripted allocation {#ariaid-title1}

* Freigeben Version: Australia
* 
* Aktualisiert 12. März 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 Minute Lesedauer

Scripted allocations define custom allocation amounts and targets by executing a
script.

## Vorbereitungen

Role required: admin, financial_mgmt_admin, or financial_mgmt_user

## Warum und wann dieser Vorgang ausgeführt wird

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}

## Prozedur

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);

**Zugehörige Konzepte**   

* [Automatic expense line creation](https://servicenow-prod.fluidtopics.net/SwngY18gnPwzYcCcz7y~aA "You can automatically create expense lines to facilitate the accurate reporting of expenses.")  
**Zugehörige Tasks**   

* [Create an allocation rule](https://servicenow-prod.fluidtopics.net/v2_uegBHOgz9i~Z2sBjRwA "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/J3Z4Y0TlkX~Avz9W16l6eg "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/3dbDEpI40Srm966uRCNCsQ "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/JxSWKkNICqTD2PI8ZgWq_g "You can create a sample expense allocation rule that allocates the cost of an incident to the department of the caller.")

