Defining distribution rules

  • Release version: Xanadu
  • Updated August 1, 2024
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Defining distribution rules

    Distribution rules in ServiceNow Financial Management enable you to allocate distribution costs according to specified criteria. These rules help you view and manage how costs are distributed across various records, ensuring accurate financial tracking and reporting.

    Show full answer Show less

    How to Define Distribution Rules

    To create a distribution rule, navigate to Financial Management > Admin > Distribution Cost Rules and select New. You must provide the following information:

    • Name: A unique identifier for the rule.
    • Active: Indicates if the rule is currently in use.
    • Advanced: If checked, distribution logic is defined by a script; if unchecked, distribution is based on table records and conditions.
    • Description: Notes or explanations about the rule’s purpose or usage.
    • Script: (When Advanced is true) Custom script to control distribution behavior.
    • Table: (When Advanced is false) The table containing records that will receive distributed costs.
    • Condition: (When Advanced is false) Criteria to filter records in the specified table for even cost distribution.

    Using the condition builder, you can preview which records will be targeted before applying the rule.

    Scripted Distribution

    Enabling the Advanced option allows custom scripts to define specific distribution amounts rather than evenly splitting costs. When scripting:

    • Write queries to identify target records and relevant data for allocation.
    • Create expense line records using the ExpenseLine API for precise cost allocation.
    • Access key variables during script execution, such as distCost (the distribution cost record) and distCostAmount (the cost amount in system currency).

    Processing Distribution Costs

    A scheduled job named Process FM Costs runs daily to automatically process all distribution costs, ensuring timely and consistent cost allocation based on your defined rules.

    Define distribution rules to view distribution costs that are distributed according to the rules.

    To define new distribution rules, navigate to Financial Management > Admin > Distribution Cost Rules, and select New and populate the following:
    Table 1. Distribution Rules form
    Field Input Value
    Name A unique name for the rule.
    Active Determines if the rule is actively used.
    Advanced If checked, the distribution rule will be determined by script. If not checked, it will be determined by table and conditions.
    Description A description of the rules and any notes on its use.
    Script If Advanced is true, the script which will determine the rule's behavior.
    Table If Advanced is false, a list list of tables to find the records to distribute the cost to.
    Condition If Advanced is false, a condition builder to determine which records will receive the distributed cost, on the table determined by the Table field. Cost amount will be distributed evenly across the records identified by the table and condition values. This field uses the Condition Count Widget to preview what records would be returned by the conditions.

    Once submitted, the Distribution Costs related list is displated, which helps determine which costs will be distributed according to the rules.

    Scripted distribution

    Scripted distributions allow for custom distribution amounts, versus the evenly split distributions when using table and condition filters.

    To enable scripted processing on a distribution rule:
    • Check the advanced field check box, this will display the script field.
    • Build the script using the following concepts:
      • Query for target records and data to use for calculating the allocation amount.
      • Create expense line records using the ExpenseLine API.

        For more information, see ExpenseLine.

    As noted in the default script, when the advanced field is enabled, the following variables are available during the script processing:
    • distCost - GlideRecord for the distribution cost, allowing access to all fields.
    • distCostAmount - cost amount in the system currency.

    Processing Distribution Costs

    A scheduled job called Process FM Costs automatically processes distribution costs daily.