Passing parameters to PaCE policies

  • Release version: Zurich
  • Updated July 31, 2025
  • 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 Passing parameters to PaCE policies

    Passing parameters to PaCE policies in ServiceNow allows you to validate updates to objects such as tables and document IDs. This capability supports both low-code and JavaScript authoring approaches. Parameters enable dynamic, context-specific policy execution and validation.

    Show full answer Show less

    Key Features

    • API Variables: These are passed at the time a policy is invoked via the PaCE API. Each policy has a single immutable API Variable named SnapshotId that cannot be modified or extended. The variable is accessed as apiVars in the code editor. A value must be provided when calling the API; otherwise, the policy will not execute.
    • Config Parameters: Defined when mapping a policy to an object, Config Parameters allow you to pass configurable values each time the policy is mapped. They are accessed as configParams in the code editor. Mandatory parameters must be specified to enable policy execution; if not, the policy becomes inactive and does not make decisions. For example, expense limits can be set differently for various employee groups and validated on policy invocation.
    • Record References: These define queries to extract data from ServiceNow tables to support policy logic. You can perform aggregate functions on record references. They are accessible as recordRefs in the code editor, allowing policies to incorporate additional data dynamically.
    • Data Collectors: Data collectors gather input data from ServiceNow or external sources to produce outputs used within policy logic decisions. They are manageable through creation, editing, updating, and activation in the policy builder and accessible via the dataCollectors object in JavaScript. Auto-completion assists by listing available outputs and data collectors during policy editing.

    Key Outcomes

    • Enable dynamic and flexible policy validation tailored to specific objects and contexts.
    • Support both developers and low-code users in passing and managing parameters efficiently.
    • Ensure mandatory parameters are enforced to maintain policy execution integrity.
    • Leverage ServiceNow data effectively within policies through record references and data collectors.

    Parameters can be passed to a PaCE policy to validate updates to an object (tables and document IDs). These variables apply to authoring in both low-code or JavaScript. Policy versions include three types of parameter inputs: API Variables, Config Parameters, and Record References.

    API Variables

    Previously known as Caller Inputs, the API Variables is passed to the PaCE API at the time of invocation by a developer. The API Variable is a variable that enables you to pass the value to the policy whenever the policy is invoked. Specify a value for this API Variable when calling the API, otherwise the policy is not executed and no decision is reached. In the code editor, the variable name is apiVars.

    For each PaCE policy, there is only one pre-defined API Variable called SnapshotId. This API Variable is Immutable and cannot be modified or deleted. You cannot define any additional API Variables for a policy.

    Config Parameters

    Previously known as Mapped Inputs, the Config Parameters can be passed when mapping policies to an object (tables and document IDs). When you define a Config Parameter, you are creating a parameter that enables you to pass values to the policy whenever the policy is mapped. If you define mandatory inputs, you must specify values for these inputs when mapping the policy. If the inputs you define are not mandatory, the policy is not executed (the status is set to inactive) and no decision is reached. In the code editor, the variable name is configParams.

    For example, for a travel expenses policy you can add variables to define the limits of different types of expenses. The limits are specified when mapping the policy, and set the limits on the expense when the policy is invoked on this object. The breakfast expense limit for one group of employees could be $25, and for a different group of employees the limit could be $50. Each time the policy is invoked, the expenses are validated by the policy according to the limits specified in the mapping.

    Record References

    Record references define queries to extract data from any ServiceNow® tables and use the data to configure the policy logic. This feature enables you to retrieve additional data that may be required while defining the policy. You can define a query to perform aggregate functions for a record reference. In the code editor, the variable name is recordRefs.

    Data Collectors

    The data collectors function collects input process data from ServiceNow or an external data source to provide an output. The output can be used in the policy logic to make a decision. You can define and manage data collectors by creating, editing, updating, and activating them to your policy builder.

    Data collectors can be accessed by using the dataCollectors object in JavaScript.
    Note:
    Auto-completion lists all possible outputs and data collectors that are available to use.

    While editing a policy in low-code, an output of the configured data collectors is available under the drop-down menu.