logo

NJP

Edit Module - How to remove bookmarking - favorites

Import · Jul 26, 2022 · article

How to remove the bookmark?

How to remove a favorite?

Sometimes we need to edit a module but it's not enough when another thing could enable access to the user, ACL for example, however, it could be needed to take off/remove these bookmarks, when how could we do it?

it's not so easy as just edit a module, but it's the first step

Image Description
image 01. Search by a module that needs to update
image 02. Click on edit
image 03. on the Visibility tab
image 04. Click Edit
image 05. Edit roles available as need
image 06. Click Done
imageimage 07. Click update

Creating a script to remove favorites

Image Description
image 01.Navigate to >> System Definition > Fix Scripts
image 02. Click New
image 03. type a name of fix script
image 04. Type a name for Description
image 05.Type the script
image 06.Click Update
image 07. Run Fix Script
var grBook = new GlideRecord('sys_ui_bookmark');
grBook.addEncodedQuery('urlSTARTSWITHu_ppm_templates_list.do');
grBook.query();
while (grBook.next()) {
    var myUser = gs.getUser().getUserByID(grBook.user);
    if (!myUser.hasRole('ppm_pmo') && !myUser.hasRole('ppm_project_manager')) {
        grBook.deleteRecord();
    }
}


image

Summary

Fix Script official documentation

View original source

https://www.servicenow.com/community/developer-articles/edit-module-how-to-remove-bookmarking-favorites/ta-p/2301303