Bulk changing the font size of Catalogue Item description field

RichardSaunders
Tera Guru

Does anyone have any idea how to bulk change the font size of Catalogue Item description field. We have an accessibility requirement where we need to change the Description font to Arial and size from 10 to 12.

 

I have tried the following background script but unable to get it working consistently. 

 

Can anyone help? 

 

 

 

// Query the 'sc_cat_item' table
var item = new GlideRecord('sc_cat_item');

// Only select active records
item.addQuery('active', true);
item.setLimit(10);  // Limit to the first 10 records
item.query();

while (item.next()) {
    var description = item.description;
    
    // Check if the description contains a <style> tag and replace it
    if (description.indexOf('<style>') !== -1) {
        // Using a regex to replace the content within the <style> tags
        var updatedDescription = description.replace(/<style>.*?<\/style>/g, 'style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"');

        // Update the description with the new content
        // Temporarily disable workflow processing for this update
        item.setWorkflow(false);
        item.description = updatedDescription;
        item.update();

        // Log the name of the item whose description was updated
        gs.info('Updated item: ' + item.name + ' (' + item.sys_id + ')');
    }
}

 

 

 

 

4 REPLIES 4

Dhananjay Pawar
Kilo Sage

Hi,

Instead of script try to add the style for description field.

 

Right click on 'description' field and then click on the 'configure styles' and add the style as per your choice (check attached screenshot).

 

Thanks,

Dhananjay.

RichardSaunders
Tera Guru

I can't seem to get that working, i created the style. But it still shows as in the backend and portal in the smaller font.

 

RichardSaunders_0-1713275110476.png

RichardSaunders_1-1713275135404.png

RichardSaunders_2-1713275161928.png

 

Open the catalog item and come down to description field there itself you have options to do the changes.

Not for 4527 cat items