Migrate from one scope to Global
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 07:48 AM
Hello All,
Our project is in migration state currently and as part of this we are going to deprecate our custom application and decided to have everything in global. Now there are so many things to capture is there a way I can capture everything in same scope and also update the application scope to 'global' ..We are not using any tool for migration. we have to move everything via update sets.
All suggestions are welcome here
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2024 08:28 AM - edited ‎07-16-2024 12:32 PM
Hi,
If you can change the 'sys_scope' value on the records in the 'sys_metadata' table for your custom application, you may get what you want.
Try the following in scripts background
// change app scope
var sm = new GlideRecord('sys_metadata');
// looking for records in scoped app
sm.addEncodedQuery('sys_scope=750580ef1bbaf810cc6498e8bc4bcb82^sys_class_name!=sys_metadata_delete');
sm.query();
gs.info ("chgAppScope: found " + sm.getRowCount() + " records to process");
while (sm.next()) {
gs.info ("chgAppScope: Name = " + sm.sys_name + ", scope = " + sm.sys_scope.getDisplayValue());
sm.sys_scope = 'global';
// sm.update();
}
A better approach may be to change the 'application' value on the update set records, you can try:
// change app scope
var sux = new GlideRecord('sys_update_xml');
// looking for records in scoped app
sux.addEncodedQuery('application=750580ef1bbaf810cc6498e8bc4bcb82');
sux.query();
gs.info ("chgAppScope: found " + sux.getRowCount() + " records to process");
while (sux.next()) {
gs.info ("chgAppScope: Name = " + sux.name + ", application = " + sux.application.getDisplayValue());
sux.application = 'global';
// sux.update();
}
Find the update_set record in the 'sys_update_set' table and change the 'application' value on that record. Then check the related update sets.
When run in scripts background, you can roll back the changes made. Good luck.
Seems the best option is to publish the app to an update set, download those, and change the 'application' value to 'global' where the value matches that of the scoped app value using a text editor. then when imported in another instance, they should be in the "Global" scope.