Not able to see the upload and delete button on icon and picture tab in service catalog page

RishabhY4399968
Giga Contributor

I have created an scheduled script which attaches the icon and picture for the catalog items which does not have any icon or picture or both. When the image is attached using the scheduled script the option to update and delete icon and picture are not visible.

(function () {
 
    var IMAGE_SYS_ID = '797a68b6c3748b10ac28447dc0013154';
 
    var cat = new GlideRecord('sc_cat_item');
 
    // Only ACTIVE catalog items AND where icon or picture is missing
    cat.addEncodedQuery('active=true^iconISEMPTY^ORpictureISEMPTY');
 
    cat.query();
 
    var updatedCount = 0;
 
    while (cat.next()) {
 
        var needsUpdate = false;
 
        if (cat.icon.nil()) {
            cat.icon = IMAGE_SYS_ID;
            needsUpdate = true;
        }
 
        if (cat.picture.nil()) {
            cat.picture = IMAGE_SYS_ID;
            needsUpdate = true;
        }
 
        if (needsUpdate) {
            cat.setWorkflow(false);
            cat.autoSysFields(false);
            cat.update();
            updatedCount++;
            gs.info('[Catalog Image Job] Updated item: ' + cat.name + ' (' + cat.sys_id + ')');
        }
    }
 
    gs.info('[Catalog Image Job] Completed. Total items updated: ' + updatedCount);
 
})();

Above is my scheduled job the sys_id of the image is given from the sys_attachment table. When I try to attach the image from db_image table, the image is not getting attached. Is there any workaround or troubleshooting method to make the upload and delete buttons visible for icon and picture again?

I've attached the image which shows the issue.
1 REPLY 1

Ankur Bawiskar
Tera Patron

@RishabhY4399968 

how about when added from UI?

you see the delete button?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader