Catalog item- How to call values in Drop down variable via system property
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 07:21 AM
Hello Experts,
I have got a use case scenario where we required to populate values in a drop down variable in a catalog item. And those values should be coming via system property. Field is depended on another drop down.
Thanks in advance
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 08:00 AM
Hi,
Please try the below steps.
1. Create System Properties: Define a system property with the values for the dropdown.
2. Create a Script Include: Write a Script Include to fetch the values from the system property.
3. Create a Catalog Client Script: Create a Client Script that triggers on change of the primary dropdown and populates the dependent dropdown with values fetched from the Script Include.
4. Configure Catalog Item Variables: Ensure you have two dropdown variables in your catalog item - one primary and one dependent.
Thanks,
Keerthi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 09:05 PM
why to have system property? choices needs to be there in choices table
what's the business requirement for this?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 09:26 PM
Hi @Kamini07 , It is not possible with multiple choice, instead choose Select Box, then
In the onLoad catalog client script -
var ga = new GlideAjax('ClientSideCall');
ga.addParam('sysparm_name', 'getProperty');
ga.getXML(getP);
function getP(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
var arr = answer.split(',');
for (var i = 0; i < arr.length; i++) {
g_form.addOption('drop_down', i, arr[i], i);
}
}
In the Glide AJAX enabled script Include -
var ClientSideCall = Class.create();
ClientSideCall.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getProperty:function(){
return gs.getProperty('drop.down.sys.property');
},
type: 'ClientSideCall'
});