Understanding Catalog Variables in ServiceNow - ben-vargas/servicenow-wiki GitHub Wiki
This article explains how catalog variables function within ServiceNow's Service Catalog, outlining the relationships between various catalog components using the provided diagram. Understanding these relationships is crucial for designing effective and user-friendly catalog items.
Overview
The provided diagram depicts the flow and connections between several key ServiceNow tables and their relationships to Catalog Variables. These components together build the data model for service catalog items, allowing users to create requests, provide input, and manage configurations.
Key Components
The following components are highlighted in the image and described below:
document
:- This represents a generic document that may be associated with a Question Answer, as it the parent of the question answer table.
Question Answer [question_answer]
:- This table stores the responses to questions asked in a catalog item. It is related to both the
document
and theQuestion
tables.
- This table stores the responses to questions asked in a catalog item. It is related to both the
Question [question]
:- This table stores the definitions of questions used in catalog items, it is the parent of the variable table and the
Question Choice
table.
- This table stores the definitions of questions used in catalog items, it is the parent of the variable table and the
Question Choice [question_choice]
:- This table stores the predefined choices for specific questions, often presented as a list. It is related to the
Question
table. It has a "no link" line leading to theOptions
table in the diagram, which likely means there is no direct database relationship.
- This table stores the predefined choices for specific questions, often presented as a list. It is related to the
Variable [item_option_new]
:- This table is a core component for catalog variables. This table stores the specific attributes and configurations of variables (input fields) within a catalog item.
- It extends the
Question
table, adding extra functionality to the base question functionality. - It is directly related to the
Variable Set
andCatalog Item
tables.
Variable Set [item_option_new_set]
:- This table allows for grouping of variables together so they can be reused across different catalog items, acting as a collection of variables.
- It is related to the
Catalog Variable Set
table and theCatalog Item
table.
Catalog Variable Set [io_set_item]
:- This table defines the reusable variable sets that can be added to catalog items, and other record producers.
- The relationship to the
Variable Set
table is thatcatalog_variable
points to the sys_id of the variable set
Catalog Item [sc_cat_item]
:- This table defines the actual catalog items that users interact with when submitting a request, it has relationships to the variables and variable sets.
Variables [sc_item_variables_task]
: * This table links aRequested Item
to the differentVariables
that are configured in the service catalog, in order to save the values for those variablesCatalog Task [sc_task]
:- This is the table that will create a task based on an item being requested. This is directly related to the
Requested Item
table, it is created as part of a Requested Item.
- This is the table that will create a task based on an item being requested. This is directly related to the
Variable Ownership [sc_item_option_mtom]
:- This many-to-many relationship table is used to link specific options to the variables on the form, where specific options exist for variables. This links options on the
Options
table to theVariable
table.
- This many-to-many relationship table is used to link specific options to the variables on the form, where specific options exist for variables. This links options on the
Requested Item [sc_req_item]
:- Represents an individual line item in a catalog request. This item is the parent of the
Catalog Task
table, and is related to theCart Item
table.
- Represents an individual line item in a catalog request. This item is the parent of the
Options [sc_item_option]
:- This table defines the different options for a question of type "Choice", and is linked to the
Cart Item
via aCart Item
reference field.
- This table defines the different options for a question of type "Choice", and is linked to the
Cart Item [sc_cart_item]
:- This represents an item that exists in the service catalog cart prior to the checkout. This has a relationship with the
Shopping Cart
table, and theOptions
table.
- This represents an item that exists in the service catalog cart prior to the checkout. This has a relationship with the
Shopping Cart [sc_cart]
:- This table represents the users shopping cart and contains the relationship to the
Cart Item
table.
- This table represents the users shopping cart and contains the relationship to the
Catalog UI Policy [catalog_ui_policy]
:- Defines UI policies that affect the user interface based on the values of variables in a form.
- UI Policies are connected to the catalog item via reference field on this table.
Catalog UI Policy Action [catalog_ui_policy_action]
:- Defines the actions performed by a catalog UI Policy, such as making a field visible, hidden, read-only or mandatory.
- UI Policy actions are connected to a UI Policy and a variable with a reference to that variable.
Relationships and Flow
Here's a breakdown of how these components work together:
- Defining Variables:
- Administrators create variables in the
Variable [item_option_new]
table. They can configure their type, display name, help text, and other properties, including validation scripts to ensure proper input.
- Administrators create variables in the
- Organizing with Variable Sets:
- Variables can be grouped into reusable Variable Sets in
Variable Set [item_option_new_set]
. These are stored in theCatalog Variable Set [io_set_item]
table, and then linked to specific catalog items, making it easier to share a common set of variables.
- Variables can be grouped into reusable Variable Sets in
- Building the Catalog Item:
- When creating a catalog item (
Catalog Item [sc_cat_item]
), you can associate it with Variable Sets and individual variables, by adding theVariable
orVariable Set
to the form.
- When creating a catalog item (
- User Interaction:
- When a user accesses the catalog item, the defined variables render as interactive input elements on the catalog form.
- As users interact with the UI, the choices in
Question Choice [question_choice]
are displayed if a question type is "Choice".
- Request Submission:
- When a user submits a request, the entered values are stored in
Question Answer [question_answer]
or the values are placed into theVariables [sc_item_variables_task]
table linking the variables to theRequested Item
and are also stored within theCart Item
records. - The
Requested Item [sc_req_item]
record is created, which includes the values from variables specified by the user, and contains a reference to theShopping Cart [sc_cart]
andCart Item [sc_cart_item]
records. Catalog Task [sc_task]
records are created as part of the workflow defined for theRequested Item
.
- When a user submits a request, the entered values are stored in
- UI Policies:
Catalog UI Policy [catalog_ui_policy]
records are created and associated with a catalog item, they are configured with conditions based on values in variables on the form.Catalog UI Policy Action [catalog_ui_policy_action]
records are linked to a UI policy and define actions (such as setting visibility, read-only, or mandatory status) on variables, based on a condition on the form.
Additional Notes
- (link can be removed without deleting data for old requested items): This note in the diagram indicates that there is some type of many-to-many relationship or other complex data model where the connection between the entities can be removed and the history of the values can still be retained in the older records.
- (catalog_variable (String)): Represents the relationship between the Catalog Variable Set and the Variable Set and shows that the field in the Catalog Variable Set points to a record in the
Variable Set
table. - Record Producers: Though not fully detailed in this image, Record Producers are another type of catalog item. The image has
Record Producers - sc_item_produced_record
, which points to thetask
table,Producer -> sc_cat_item_producer
, which links the record producer to a catalog item,question_answer
, for the answers provided,table_sys_id
, representing the source record. Then also references theQuestion --> item_option_new
which represents theVariable
table and thevalue
for the variable.
Key Takeaways
- Variables are Fundamental: Catalog variables are central to capturing user input in a structured manner.
- Variable Sets for Reuse: Variable sets promote reusability and consistency across catalog items.
- Relationships are Crucial: Proper configuration of relationships between these different components ensures correct functionality of the service catalog.
- Dynamic Behavior: UI Policies and actions allow for dynamic modifications of the UI based on variable selections.