How to Access Variable set based on Variable selection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
HI,
I have a doubt on this
Catalog item variable name : Environment choices , prod,test,dev
variable set field : Server name : reference cmdb_aix_server
When I select the Environment choice in the catalog variable, only the corresponding servers (Dev, Test, or Prod) should be available in the Server Name field. The reference list must be filtered based on the selected environment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
35 seconds ago
Hi @rajibosss11 ,
To filter the Server Name reference variable based on the selected Environment (Dev/Test/Prod) in a catalog item or variable set, you should use an Advanced Reference Qualifier along with a Catalog Client Script.
Step-by-Step Configuration
1. Catalog Variable – Server Name
Type: Reference
Reference table: cmdb_aix_server
Navigate to:
Catalog Item / Variable Set → Variables
Open Server Name
Set Reference qualifier = Advanced
Script:
Update u_environment to the actual environment field name in your CMDB table if it differs.
2. Catalog Client Script (onChange)
This ensures the reference list refreshes when the environment changes.
Navigate to:
Service Catalog → Catalog Client Scripts → New
Configuration:
Applies to: Catalog Item (or Variable Set)
Type: onChange
Variable name: environment
Script:
Result
Selecting Dev → only Dev servers are shown
Selecting Test → only Test servers are shown
Selecting Prod → only Prod servers are shown
The server list updates dynamically without page reload.
If you find this response helpful, please mark it as Helpful and accept it as the solution if it addresses your question—it would encourage me to contribute more to the ServiceNow Community.
Thanks & regards,
Sachin Narayanasamy
