Open state management
Summarize
Summary of Open State Management
The Open State Management framework within the Configuration State Model API allows developers to program variations in product options displayed in the product configurator for Sales and Order Management. It enables control over the visibility and editability of nodes in the user interface based on specific events, enhancing the configurator’s functionality without needing extensive JSON scripting.
Show less
Key Features
- State Control: Manage node visibility (Yes/No) and editability (Yes/No) for various product attributes.
- Events Framework: Utilize two primary events: On Load (initial state setting) and On Change (state changes based on user interactions).
- Helper API Methods: Access a set of methods to read and set states for product characteristics, including:
- Getter Methods:
getAllNodes(): Retrieves all node paths and their states.getNode(nodePath): Fetches states for a specified node.
- Setter Methods:
setVisible(nodePath, True/False): Sets visibility for a node.setEditable(nodePath, True/False): Sets editability for a node.
- Context Variable Methods:
getHeaderContextVariables(): Lists all header context variables.getLineContextVariables(): Lists all line context variables.
- Getter Methods:
Key Outcomes
By effectively utilizing the Open State Management framework, ServiceNow customers can tailor the product configurator experience to meet specific business rules and customer needs. This results in improved user experience, compliance with regulations, and optimized product selection based on customer attributes.
The open state model is a programmatic framework in the Configuration State Model API, which enables you to program variations in product options that appear in the product configurator in Sales and Order Management. The API framework provides certain states and helper API methods for controlling how nodes in the product configurator user interface are displayed.
Use cases for configuration state management
| Product configurator use case | Example |
|---|---|
| Hide certain options for a customer | A product attribute selection isn’t displayed for customers in California due to state safety regulations. |
| Set certain default options for a customer | For upgrades, only the Ultimate plan is displayed for existing customers who have a premium plan. |
| Allow only certain options to be selected based on other attribute options | For certain products such as laptops, display all sizes 13", 15", and 17", but display only 15" and 17" laptops if only the touchscreen feature is required. |
You can manage the display of options in the product configurator by using the Configuration State Model API Framework.
Framework overview
- Visible - Yes (make node visible) or No (make node invisible).
- Editable - Yes (show node and make it selectable) or No (show node but make it unselectable).
- On Load - The state (visibility, editability) of each node is initially set to Yes (true). The open state is invoked on loading.
- On Change - This function is called whenever there’s a change in a node's value in the product configurator user interface. However, this state isn’t invoked when quantity changes occur in the product configurator.
Helper API methods
- Apply states
- Set the visible and editable states for product relationship groups, product characteristics, and product characteristic options using Getter and Setter methods to read and change the state of the configuration model.
- Getter methods
- Obtain node paths along with the states on any configuration node:
- getAllNodes(): Returns JSON with node path (reference to code) and its respective relative path with all the states.
- getNode(nodePath): Return all the states for the specified node path if it exists.
- Setter methods
- Set the visible and editable states for product relationship groups, product characteristics, and product characteristic options.
- setVisible: True/False at all levels
- setVisible(nodePath, True/False)
- setEditable: True/False at all levels
- setEditable(nodePath, True)
- Getter context variable methods
- Retrieve context variables inside the product configurator user interface.
- getHeaderContextVariables(): Returns a list of all the header context variables.
- getHeaderContextVariableValue(contextVariable): Returns a value and display value of a specific context variable in the header.
- getLineContextVariables(): Returns a list of all the line context variables.
- getLineContextVariableValue(nodePath, contextVariable): Returns the value of a specific context variable in the line.