How do we set the category and sub category based on CI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2022 07:33 AM
Hi All,
Incident created from third party with CI.
We have multiple Configuration item(reference cmdb_ci table) with category and subcategory.
how to set the category and sub category based on CI.
Regards,
Tharun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 05:33 AM
Hello Tharun,
Configure the Dictionary for Category and Subcategory field and in that set the Configuration Item as a Dependent field.
Please mark my answer as helpful/correct if it helps you.
Thanks,
Namrata

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2022 06:11 AM
Hi Tharun,
As suggested by Namrata, you can use dependent field in dictionary level.
Or else if list is big, you can use an on Change client script
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2022 03:28 AM
Feel free to reach out if you have further questions or else you can mark appropriate answer as correct and helpful to close the thread so that it benefits future visitors also.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2023 03:57 AM
// Remove dependency between company and configuration item and create onchange client script for configuration item field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var category = Array.from(g_form.getElement('category')).map(function(item) {
return item.text;
});
var ci = g_form.getReference('cmdb_ci', setRelatedValue);
function setRelatedValue(cmdbCI) {
var ciCompany = cmdbCI.company || '';
var ciCategory = cmdbCI.category || '';
var ciSubcategory = cmdbCI.subcategory || '';
g_form.setValue('company', ciCompany);
g_form.setReadOnly('company', Boolean(ciCompany));
if (category.includes(ciCategory)) {
g_form.setValue('category', ciCategory);
setTimeout(function() {
var subcategory = Array.from(g_form.getElement('subcategory')).map(function(item) {
return item.text;
});
if (subcategory.includes(ciSubcategory))
g_form.setValue('subcategory', ciSubcategory);
}, 1000);
}
}