Failing Widget:'subcategory'

Krivi
Tera Contributor

Hi 

Creating a new kb portal. Need to display subcategory of kb as card in subcategory widget some error are popup.

2 REPLIES 2

Kieran Anson
Kilo Patron

You've got an undefined variable, can you share your widget code?

Krivi
Tera Contributor

Hi Kieran,

You are right . There is a undefined variable. I have fixed the issue. Thank you so much😊.

// Query for subcategories under the given category ID
               c.data.kbCate= [];
    var categoryId = $sp.getParameter('kb_category');
        var kbCategoryGR = new GlideRecord('kb_category');
        kbCategoryGR.addQuery('parent_id', categoryId);
    kbCategoryGR.orderBy('label');
        kbCategoryGR.query();

        while (kbCategoryGR.next()) {
                    var subcat={};
                    subcat.label=kbCategoryGR.label.toString();
                    data.kbCate.push(subcat);
                   
         
        }