Based on selection, populate related list (child tab) of software applications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 03:51 AM
Hi,
I have a requirement to one of the catalog items for the persona selected ,populate the related list (child tab) of software applications for user guidance.
refer the screenshot
here the field refers to custom table 'u_vdi_image' when user selects 'Architecture 2018/2019 (ARC1819)' , there is new variable that should show the related list of child tab. how to achieve this kindly help me with code, thanks.
child tab refers to cmdb_rel_ci table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 05:39 AM
Hi,
You can use reference qualifier for your Variable that show the list for Childs.
You can add condition like below:
javascript: 'parent='+current.variables.softaware_architecture.toString()
Replace the name of your softaware_architecture variable in above.
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 06:21 AM
Hi Anil , thanks for replying
here new variable which shows the list of child record should be read only . i am not even sure which data type to select for this variable , please let me know if u have idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 05:44 AM
I guess you will need a catalog client script and a script include.
Try it with something like this (you may need to tweak it):
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
// Clear the child_ci choice field first
g_form.clearOptions('child_ci');
// Call the server to get the related child CIs
var ga = new GlideAjax('GetChildCIsAjax');
ga.addParam('sysparm_name', 'getChildCIs');
ga.addParam('sysparm_parentCI', newValue);
ga.getXMLAnswer(function(response) {
var childCIs = JSON.parse(response);
childCIs.forEach(function(ci) {
g_form.addOption('child_ci', ci.sys_id, ci.display_value);
});
});
}
var GetChildCIsAjax = Class.create();
GetChildCIsAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getChildCIs: function() {
var parentSysId = this.getParameter('sysparm_parentCI');
var childCIs = [];
// Query the cmdb_rel_ci table to find related child CIs
var relGR = new GlideRecord('cmdb_rel_ci');
relGR.addQuery('parent', parentSysId);
relGR.query();
while (relGR.next()) {
var childCI = {};
var ciGR = new GlideRecord('cmdb_ci');
if (ciGR.get(relGR.child)) {
childCI.sys_id = ciGR.sys_id.toString();
childCI.display_value = ciGR.getDisplayValue();
childCIs.push(childCI);
}
}
return JSON.stringify(childCIs);
}
});
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 06:24 AM
Hi Mark , thanks for replying
here new variable which shows the list of child record should be read only . i am not even sure which data type to select for this variable , please let me know which data type u are referring for child_ci .