Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Workflow catalog variables

Workflow catalog variables

Workflows that are associated with the Requested Item [sc_req_item] table have a specific type of workflow input.

The inputs into this workflow are essentially question:answer pairings that, when associated with a specific catalog task, become options on the task form. These options are generated by that catalog task activity within a workflow.

Scope

For the purposes of Service Catalog and workflow, a variable’s scope determines its availability to a catalog task activity within a workflow. You can define variables as global or catalog item-specific. When a variable is associated to a catalog item and the workflow generating the catalog task is associated to the catalog item, the variable scope determines which variables are available for mapping within the catalog task activity in a workflow. If a workflow is associated with Requested Item [sc_request_item], and is not specifically associated with a catalog item, any catalog variable with a blank Cat Item field value is available to all catalog task activities within the workflow.

Declaration

You can declare requested item catalog variables at the catalog item level or at a global level.

About this task

You can declare global catalog variables using the Workflow Editor context menu.

Also see, Global variable declaration option 2.

Procedure

  1. Navigate to Workflow > Workflow Editor.
  2. Open and check out a workflow that runs against the Requested Item [sc_req_item] table.
  3. Click the menu icon and select Edit Catalog Variables.
  4. Click New to create a new variable or select an existing variable.
  5. Select the Global check box.
  6. Click Submit.

Global variable declaration option 2

You can declare global catalog variables using the Service Catalog.

  1. Navigate to Service Catalog > Item Variables.
  2. The list of variables that appears in the workspace has a default filter of Cat Item != <blank>. Change the filter to Cat Item = <blank> and run the query.

    The catalog variables that appear are available to any catalog task that is initiated from within a workflow.

  3. Click New to create a new variable.
  4. Leave the Cat Item field blank.
  5. Select the Global check box.
  6. Click Submit.

Catalog item specific variable declaration option 1

You can declare a catalog item-specific variable.

About this task

These variables are only available to the catalog item referenced in the Cat Item field on the variable record.

Procedure

  1. Navigate to Service Catalog > Catalog Variables > Item Variables.
    Note the list of variables that appears in the workspace has a default filter of Cat Item != <blank>.
  2. Enter or select a catalog item in the Cat Item reference field.
    Selecting a Cat Item restricts the scope and availability of the catalog variable to that specific catalog item.
  3. Click Submit.

Catalog item specific variable declaration option 2

You can declare a catalog item-specific variable directly from a catalog item record.

About this task

Creating a catalog variable in this way automatically sets the Cat Item reference to the catalog item selected.

Procedure

  1. Navigate to Service Catalog > Catalog Definitions > Maintain Items.
  2. Select or create an a catalog item.
    Note the Variables related list. All variables declared using this related list have a Cat Item reference value of the current catalog item.
  3. From the Variables related list, click New.
  4. Ensure that the Cat Item field correctly references the catalog item previously selected or created.
  5. Go to or open the Question section or tab.
  6. Add a Question.
  7. Add a Name.
    Variable names should not include white space and cannot begin with a number.
  8. Click Submit.

Display

Catalog specific item variables are visible in several places depending on where in the process the variable is viewed.

Declaration can happen and variables can be seen from within the menu, inside both the Maintain Items module and in the Item Variable modules of the Service Catalog.

Within a workflow, the Catalog Specific Item variables are available to the Catalog Task activity in the form of a slushbucket at the bottom of the Catalog Task activity. Item variables that are selected, are the question and answer pairs that will appear on the task that is generated by that instance of Catalog Task when executing that workflow.

If a workflow is associated with a specific catalog item, the association acts as a filter for item variables that appear in the slushbucket of the Catalog Task activity.

The last place the variables are seen is in the task form that is generated by the Catalog Task Item. The variables selected in the slushbucket are the question and answer pairs that appear to the user on the task form.

Access and assignment

The Catalog Item Variables are available and assigned to a specific Catalog Task activity (thereby to a specific task) using the slushbucket entry of a catalog task.

The user working the task enters the values of the variables.

To access the values of a Catalog Item Variable inside a script:
var gr  = current ; // or create and query a new GlideRecord 
var itemVariable  = gr. variables [ variableName  ] ; //access the service catalog variable identified by the variable name. 
var itemValue  = itemVariable. getGlideObject ( ). getValue ( ) ; 
var itemQuestion  = itemVariable. getGlideObject ( ). getQuestion ( ). getLabel ( ) ;