T
oday’s post comes in response to a ServiceNow community question related to the UI14 bookmark capability. I’ve written before about customizing some of the UI changes in the ServiceNow Eureka release. The question posed today was specifically about changing the default colors (and potentially images) used for bookmarks in the edge pane. In this post I’ll show you how to customize these bookmarks via the ServiceNow admin UI.
Where does ServiceNow store bookmark information anyway???
User bookmark information is stored in the ‘Bookmark [sys_ui_bookmark]’ table which can be accessed by navigating to ‘System Definition -> Bookmarks’ in the left nav. Here you can identify bookmarks per user along with their associated settings. Included in these settings is the ability to set global bookmarks, icons, links, etc. Generally it’s much more effective to set this information directly from the simple UI provided by ServiceNow in the edge pane itself. But what if you don’t like the default icon and color used when you create a bookmark? This requires some additional intervention via the back-end table structure.
As shown in the screenshot above, ServiceNow uses a combination of icon and color shortcodes to determine the appearance of a bookmark in the UI14 edge pane. The common defaults I’ve identified include the following…
- icon-view color-green (Module link default)
- icon-book color-blue-dark (List breadcrumb/filter default)
How to adjust the default icon look for bookmarks…
These shortcodes end up getting set in the ‘icon’ field (which is hidden by default) in the bookmark record. As far as I’ve been able to tell, if you want to change the defaults set here, you need to do so using a ‘before insert’ business rule on the ‘sys_ui_bookmark’ table. A script like this can be used to make these adjustments. Simply change the icon and color shortcodes within the ‘if’ statements accordingly!
Name: Set Default Bookmark Colors
Table: Bookmark [sys_ui_bookmark]
When: before
Insert: true
Condition: !current.icon.nil()
Script:
if(current.icon == 'icon-view color-green'){
current.icon = 'icon-view color-red';
}
//Change default bookmark color (dark blue) to orange
if(current.icon == 'icon-book color-blue-dark'){
current.icon = 'icon-book color-orange';
}
//Change default record form (red) to green and icon from form to list
if(current.icon == 'icon-form color-red'){
current.icon = 'icon-list color-green';
}
Is there any way to hide favorite icon via script?
This is not possible. This would require using a Global UI Script and DOM to manipulate the visibility of the favorite icon which is not possible in ServiceNow. Also, the use of DOM in ServiceNow is to be avoided as much as possible.