Bulk changing the font size of Catalogue Item description field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 03:39 AM
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 + ')');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 04:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 06:49 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 10:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 11:55 PM
Not for 4527 cat items