logo

NJP

Creating Bookmarks for all members of a group

Import · Dec 17, 2014 · article

We talked about several options on how users in our Call Center can have quick access to certain KB articles.

We landed on making a script that will add a bookmark when a users is added to the Call Center Group.

Here is a sample of that code that will only run 'on change' for the call center group

var grpm = new GlideRecord('sys_user_grmember');

grpm.addQuery('group',current.sys_id);

grpm.query();

while (grpm.next()) {

var chk = new GlideRecord('sys_ui_bookmark');

chk.addQuery('title','EscalationWorkflow');

chk.addQuery('user',grpm.user);

chk.query();

if (chk.getRowCount() < 1) {

gs.addInfoMessage('User: ' + grpm.user.getDisplayValue() + " Escalation Bookmark created " );

var p = new GlideRecord('sys_ui_bookmark');

p.initialize();

p.title = 'EscalationWorkflow';

p.user = grpm.user;

p.order = 999;

p.url = 'kb_knowledge.do?sys_id=09558ce7554fa90df865xxxc2f7351&sysparm_record_target=kb_knowledge';

p.image = 'images/icons/disputes.gif';

p.icon = 'icon-view color-red';

p.insert();

}

}

View original source

https://www.servicenow.com/community/developer-articles/creating-bookmarks-for-all-members-of-a-group/ta-p/2317101