Use a scripted allocation

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 2분
  • Scripted allocations define custom allocation amounts and targets by executing a script.

    시작하기 전에

    Role required: admin, financial_mgmt_admin, or financial_mgmt_user

    이 태스크 정보

    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.

    프로시저

    1. Navigate to All > Costs > Administration > Expense 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.
      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.

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

      allocation.createAllocation(targetGlideRecord, amount);