how to auto populating category and subcategory based on the CI class?

RMU
Tera Contributor

populating category and subcategory based on the CI
#incident 

9 REPLIES 9

AndersBGS
Tera Patron
Tera Patron

Hi @RMU ,

 

why would you do that? Can’t there be several rights answers in category/subcategory for the same CI?

 

if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Community Alums
Not applicable

 

Hi,

If it involves application Configuration Items (CIs), you can auto-populate them using a script. You can utilize the Category and Subcategory of the Application CIs for this purpose. 😊

SelvaA_0-1716407245855.png

If you believe the solution provided has adequately addressed your query, could you please **mark it as 'Helpful'** and **'Accept it as a Solution'**? This will help other community members who might have the same question find the answer more easily.

 

Thank you for your consideration.

RMU
Tera Contributor

can you provide script please

 

 

Hi @RMU ,

 

You'll have to write a script to fetch the category and subcategory from the related Configuration Item (CI) and populate the corresponding fields on the Incident form. 

 

Try below code in BR: 

 

(function executeRule(current) {
    // Check if Configuration Item (CI) is populated
    if (current.cmdb_ci.nil())
        return;

    // Query Configuration Item to get its category and subcategory
    var ciGR = new GlideRecord('cmdb_ci');
    if (ciGR.get(current.cmdb_ci)) {
        // Populate Category and Subcategory fields on the Incident form
        current.category = ciGR.getValue('category');
        current.subcategory = ciGR.getValue('subcategory');
    }
})(current);

 

 

If you find my response helpful, please consider selecting "Accept as Solution" and "Helpful" .

 

Thanks,

Anusha

 

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @RMU ,

 

There can be numerous CI which needs the defination of setting cat and subcat based on CI, if its for specific set of CI lets say 10-20 your can set then via client script. but its not recommended to do for bigger numbers.

 

Try using tools like predective intelligence which can do the job for you...

let me know more info on what exactly your looking and what approch have you planned ?


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect