Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

My Lists from legacy workspace

Dennis Ford
Giga Guru

We have been on legacy workspaces for about a year and a half, so our users have created quite a few "My Lists" in the legacy workspace. It appears that these will not be available (migrate) into configurable workspaces and every user will have to manually recreate each "My List" they have configured.  Is that correct?  Is it possible to write a script to recreate them all?  Thanks!  

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Dennis,

I agree with Mark that this is probably a good opportunity to see if it's time to refresh your my lists. That being said, it should be simple enough to write a script that copies the agent workspace my lists [sys_aw_my_list] to configurable workspace my lists [sys_ux_my_list]. It looks like those forms are almost identical but you'd obviously want to test extensively.

You could also build out a record producer or button that lets individual users bring their old my lists into the new workspace or start from scratch.

View solution in original post

6 REPLIES 6

Hey Zrebak, 

 

I am dealing with the same issue. I need to move the users list (sys_aw_my_list) from Agent Workspace to Configurable Workspace (sys_ux_my_list) but I cannot access the sys_ux_my_list table since it is in a private scope. Can you give more details on the work around you came up with please?

Hi, sorry for late reply.

 

This is the script that worked:

var total = 0;
var bms = new GlideRecord("sys_ui_bookmark");
bms.addQuery("url", "CONTAINS", "_list.do?");
bms.addNotNullQuery("user");
bms.query();
while (bms.next()) {
temp = {};
temp.title = bms.title;
var user = new GlideRecord("sys_user");
user.get(bms.user);
temp.username = user.user_name;
var regex = /^\/?(.*)_list\.do.*_query=(.*)/;
var match = bms.url.toString().match(regex);
var test = regex.test(bms.url.toString());
if(match != null && test) {
var tableName = match[1];
var query = match[2];
temp.order = bms.order;
var inject = new GlideRecord("sys_aw_my_list");
inject.initialize();
inject.setWorkflow(false);
inject.autoSysFields(false);
inject.title = temp.title;
inject.table = tableName;
inject.condition = query != null ? query : '';
inject.order = temp.order;
inject.sys_created_by = temp.username;
inject.sys_created_on = new GlideDateTime();
inject.sys_updated_by = temp.username;
inject.sys_updated_on = new GlideDateTime();
inject.update();
total++;
}
}
gs.info("AW lists injected: " + total);

 

Create a Fix script out of it, export out the XML, change the scope from global to the private scope, reimport and execute.