Service Catalog variable editors

  • Release version: Xanadu
  • Updated August 1, 2024
  • 3 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 Service Catalog variable editors

    Service Catalog variable editors in ServiceNow display variable values on fulfiller forms, reflecting the requester's inputs during catalog item requests. There are two primary types based on the catalog item type: theVEditorfor catalog items and thedefault variable editorfor record producers. Each editor supports specific tables and form contexts, ensuring that variable values are accurately displayed and editable where appropriate.

    Show full answer Show less

    VEditor

    • Applicable exclusively to requested items (RITM) and catalog task forms for catalog items.
    • Provided as a formatter on RITM and catalog task forms in the ServiceNow AI Platform (Xanadu release).
    • Supports catalog UI policies and catalog client scripts by enabling "Applies on Requested Items" and "Applies on Catalog Tasks" options.
    • Displays variable values sourced from the internal Options [scitemoption] table; customers should avoid adding business rules to this table.
    • To make the editor read-only, activate the onLoad client script named Variable Editor Readonly for the Requested Item [screqitem] and Catalog Task [sctask] tables; these scripts can be made conditional.
    • Dependent on the Task [task] table’s Variables column, which should remain inactive to prevent issues.

    Default variable editor

    • Designed exclusively for record producers that generate records for task-extended tables (e.g., Incident, Change).
    • Displays question values from the record producer using the internal Question Answer [questionanswer] table; business rules should not be added to this table.
    • Supports catalog UI policies, client scripts, data lookups, reference qualifiers, and dependent reference fields only on task-extended tables.
    • To enable catalog UI policies or client scripts on this editor, select the "Applies on the Target Record" checkbox.
    • Can be configured for additional task-extended tables beyond default Incident and Change tables.

    Variable editors in different interfaces

    • Agent Workspace: Automatically adds the variable editor to the Variables section if available in the Workspace view. If placed inside a section, that section will not display it. Certain variable types (Macro, Macro with Label, UI Pages) are not displayed. Some variables (Multiple Choice, Numeric Scale, Lookup Multiple Choice) appear as select boxes.
    • Service Portal: Variable editors are available for forms with the variable editor formatter, but it is recommended to use Agent Workspace UI for variable editor interactions since Service Portal is requester-focused.

    Making variable editors read-only

    • ServiceNow AI Platform and Agent Workspace: Use the GlideForm method setVariablesReadOnly() to make the variable editor read-only on requested item, target record, and catalog task forms. This method is not applicable in Service Portal.
    • Service Portal: Enable read-only mode by setting "readonlyvariableeditor": "true" in the Quick start config field of the Service Portal record. Note that variables of types UI Page, Macro, and Macro with Label remain rendered even when read-only.

    Configuring the default variable editor for task-extended tables

    After configuration, the default variable editor allows viewing and editing of question values specified by requesters through record producers on task-extended tables. This applies only to records created from record producers.

    Variable editor displays variable values in fulfiller forms. A requester, while requesting the item, specifies these variable values in the catalog item questions.

    Types of variable editors based on the catalog item type:

    • For a catalog item, the VEditor (com.glideapp.servicecatalog.VEditor) displays the values of questions in the requested item and catalog task forms.
    • For a record producer, the default variable editor (com.glideapp.questionset.DefaultQuestionEditor) displays the values of questions for records generated from a record producer for task-extended tables.
    Warning:
    The variable editor depends on the Variables column of the Task [task] table. By default, this column is inactive, and you should not make it active.

    VEditor

    The VEditor is applicable only for the requests created from catalog items.

    In ServiceNow AI Platform, this editor is a formatter added on the requested item (RITM) form (Default View) and the catalog task form (Default View).

    The VEditor is applicable only for RITMs and catalog tasks. It cannot be used for any other tables. To support catalog UI policies or catalog client scripts on the VEditor for the RITM and catalog task form, select the Applies on Requested Items and Applies on Catalog Tasks check boxes for the catalog UI policy or the catalog client script.

    Note:
    The values in the VEditor are displayed from the Options [sc_item_option] table. This is an internal table and you should not add any business rules to this table.
    To make the VEditor read-only in ServiceNow AI Platform, activate the onLoad client script, Variable Editor Readonly, for the following tables:
    • Requested Item [sc_req_item]
    • Catalog Task [sc_task]
    Note:
    You can make the Variable Editor Readonly scripts conditional, by adding conditions to them.
    Figure 1. VEditor
    Screenshot for VEditor

    Default variable editor

    The default variable editor is applicable only for record producers. This editor is a formatter added on records that are generated by a record producer for task-extended tables. This editor displays the values of questions specified in the record producer.

    By default, this editor is applicable for the Incident and Change tables. For other tables, you can configure this editor.

    Catalog UI policies, catalog client scripts, catalog data lookups, reference qualifiers, and dependent reference fields are supported on the default variable editor only for task-extended tables. To support a catalog UI policy or a catalog client script on this editor, select the Applies on the Target Record check box for the catalog UI policy or the catalog client script.
    Note:
    The values in the default variable editor are displayed in the Question Answer [question_answer] table. This is an internal table and you should not add any business rules to this table.
    Figure 2. Default variable editor
    Screenshot for the default variable editor

    Variable editor in Agent Workspace

    In Agent Workspace, the following scenarios are possible:
    • If the variable editor formatter is available in the Workspace view of the form, the variable editor is automatically added to the Variables section in the Agent Workspace UI.
    • If the variable editor formatter is added inside a section in the Workspace view of the form, that section does not display the variable editor in the Agent Workspace UI.
    The following variable types are not displayed in the variable editor.
    • Macro
    • Macro With Label
    • UI Pages
    The following variables are displayed as a select box in the variable editor:
    • Multiple Choice
    • Numeric Scale
    • Lookup Multiple Choice

    Variable editor in Service Portal

    In the Service Portal UI, the variable editor is available for forms with the variable editor formatter.

    Note:
    Since Service Portal is only for requester use cases, it is recommended to use the Agent Workspace UI for the variable editor.

    Making a variable editor read-only

    The following options are available to make a variable editor read only, depending on application.

    Service Catalog variable editors in the core UI
    The GlideForm setVariablesReadOnly() method is supported for ServiceNow AI Platform and Agent Workspace forms to make the variable editor read-only. This method is intended for requested item, target record, and catalog tasks.
    Note:
    This method is not applicable in Service Portal and is not recommended for catalog forms.
    Service Portal variable editors
    To make the VEditor read-only in Service Portal, navigate to Service Portal > Portals, select Service Portal, and specify the following code in the Quick start config field.
    "readonly_variable_editor": "true"
    Note:
    The UI Page, Macro, and Macro with Label variables are rendered even when the variable editor is read-only.