How do you push a Bookmark / Favorite to all users?

celings1
Tera Contributor

I have scoured the interwebs and the community and the best promising answer I have found is using a background script which doesnt work for me.  I havent a clue how to script so I am not sure why it doesnt work.  If anyone can assist it would be of much appreciation.

Here is the site where I found the script

https://www.servicenowelite.com/blog/2015/4/8/bookmark-administration

1 ACCEPTED SOLUTION

Hi there,

I just tested the below script on my personal development instance. Works fine if you got an example bookmark already saved. You just have to reference the sys_id!

var grBookmark = new GlideRecord('sys_ui_bookmark');
grBookmark.get('5016969c0f98b700861309bce1050e88'); // Sys Id of the bookmark to duplicate

var grUser = new GlideRecord('sys_user');
grUser.addQuery('active', 'true'); // Extend queries to your liking
grUser._query();

while(grUser._next()) {
	grBookmark.user = grUser.getUniqueValue();
	grBookmark.insert();
}

If my answer helped you in any way, please then mark it as helpful.

Please mark this answer as correct if it solves your problem. This will help others who are looking for a similar solution.
Thanks.

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

8 REPLIES 8

Hi,

use the bellow code in background script 

and impersonate with abel tuter ,you can find Bookmark Like bellow image,

var grBookmark2 = new GlideRecord("sys_ui_bookmark");
grBookmark2.initialize();
grBookmark2.url ='sys_user_list.do'; //Replace with your url
grBookmark2.title = 'Abel book'; //Replace with your title
grBookmark2.order = '1';
grBookmark2.flyout = 'true';
grBookmark2.icon = 'icon-power color-red'//Can change the icon here
grBookmark2.open_in_form = 'true';
grBookmark2.pinned = 'true';
grBookmark2.flyout_sizing = 'body';
grBookmark2.uncancelable = 'false';
grBookmark2.image = 'images/icons/help.gifx';
grBookmark2.user = 'Abel tuter';
grBookmark2.insert();

execute this much code only it creates record into sys_ui_bookmark table.

varsha

 

Hi there,

I just tested the below script on my personal development instance. Works fine if you got an example bookmark already saved. You just have to reference the sys_id!

var grBookmark = new GlideRecord('sys_ui_bookmark');
grBookmark.get('5016969c0f98b700861309bce1050e88'); // Sys Id of the bookmark to duplicate

var grUser = new GlideRecord('sys_user');
grUser.addQuery('active', 'true'); // Extend queries to your liking
grUser._query();

while(grUser._next()) {
	grBookmark.user = grUser.getUniqueValue();
	grBookmark.insert();
}

If my answer helped you in any way, please then mark it as helpful.

Please mark this answer as correct if it solves your problem. This will help others who are looking for a similar solution.
Thanks.

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

SR2
Tera Contributor

Hello Mark Roethof,

The above code is running fine, I have some queries, hope so you will clarify it.

I need to create a favorite for particular group members, and should move those favorites to test and production also.

And I need to place those favorites in an order for every user in the groups.

how do we move them if we run the script in 'scripts-background'.

 

Will be waiting for your response, 

 

Thank you.

 

Hi,

 

I tried this script, it is working fine but the icon is not coming for Favorites. I have attached the image below for your reference.

 

Thanks,

Himani