Define an assignment for provisioning rules

Provisioning rules include assignments that specify the values to assign to variables during provisioning. Before you create a provisioning rule, you configure all of the assignments that the rule might make use of.

Before you begin

Role required: cloud_admin

About this task

Any number of provisioning rules can use a particular assignment. For a rule to succeed, it must provide a value for each required variable in the requested resource.

Procedure

  1. Navigate to your provider; Amazon AWS Cloud or Micorosoft Azure Cloud or VMware Cloud and click Rules > Provisioning Rule Assignments.
  2. Click New, specify a unique Name and Description for the assignment, and then configure the following settings:
    Field Value
    Applies to items of type The type of ordered catalog items that the rule applies to. For example, VMware VMs (in the sc_vmware_cat_item table) or Amazon EC2instances (in the sc_ec2_cat_item table).

    A rule can include only those assignments that match the Applies to items of type setting in the rule.

    Order

    The system uses the Order value to determine the sequence for performing the assignments. Assignments with lower Order values are performed before assignments with higher values.

    This is a standard ServiceNow Order field.

    An assignment runs in the order that appears in the related list in the rule. You can modify the settings from the list view.

    Value type Described in the next step.
  3. The Variable to assign field appears after you specify the Value type (except for the Script type). The process for configuring the Variable to assign settings depends upon the Value type that you specify.
    OptionDescription
    Reference Specify the Reference item. The assignment assigns the sys_id of the Reference item to the variable that is specified in Variable to assign.
    Constant Value to assign to the variable.
    Script A script makes assignments to the assignments object and has access to the following data:
    • The requested resource (sc_req_item record).
    • Values that were set by previously-run assignments (in the assignments object).
    • Variables that use a temporary, in-memory, object to hold values for use by subsequent assignments. The script should add values needed by subsequent assignments to the rule_variables object.
    • Loggers to log messages in the same way as the provisioning rule engine logs messages.
    For VMware, the base system includes several example assignments. For instance, one example assignment filters networks for a cluster and assigns the network sys_ids to a rule variable named networkIds for use by any subsequent rule (as described in the instructions for the Set by filter assignment type).
    Set by Filter

    Set by Filter assigns the sys_id of the first record that matches a specified condition.

    See Configure a 'Set by Filter' assignment.
  4. Save the assignment definition.

What to do next

Specify as many additional assignments as are needed.