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

 Release :

    - australia

ft:locale :

    - pt-BR

ft:publication_title :

    - Australia IT Service Management

ft:clusterId :

    - itsm

bundleId :

    - itsm

workflow :

    - Technology


---

# Use a scripted allocation

# Use a scripted allocation {#ariaid-title1}

* Versão de lançamento: Australia
* 
* Atualizado 12 de mar. de 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 min. de leitura

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

## Antes de Iniciar

Role required: admin, financial_mgmt_admin, or financial_mgmt_user

## Por Que e Quando Desempenhar Esta Tarefa

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}

## Procedimento

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

**Conceitos relacionados**   

* [Automatic expense line creation](https://servicenow-prod.fluidtopics.net/Mb~XC1OBpObzmyYLxZS2Jg "You can automatically create expense lines to facilitate the accurate reporting of expenses.")  
**Tarefas relacionadas**   

* [Create an allocation rule](https://servicenow-prod.fluidtopics.net/hfh3slGxDb91WsqyJPKBHw "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/MGwI7rcqKz05WI7asb9kXA "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/guZYgiGVVT3PrXgO3UDpUw "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/6a1B09fGsc1JkuHytBtGcg "You can create a sample expense allocation rule that allocates the cost of an incident to the department of the caller.")

