- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-02-2018 06:10 PM
Hi All,
We have a large Database view that is created by Joining Multiple Tables. This database view is created long back and it was not captured in an Update set. Now my requirement is to capture this Database in an Update set and Move it to our Test Instance. I created an Update set and captured few database view tables and table fields by changing values in fields and changing them back(That way am not making any changes). Thing is I have 8 Database view Tables and 170 Database view Table fields. Its really a pain to capture a Database view in an update set if i do it my way.
Is there any other way to ease the Process, also after doing some research online, I saw some posts where they described applying an update set which contains a Database view will result in Preview errors for each table/field in the Database view. If am pushing such a large Database view in an update set, wont it result in the same preview errors?
Any help is greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-02-2018 06:25 PM
- This UI Action wont work in Scoped Apps.
How it Looks:
//Push the Database view basic info into the current update set
var updateSet = new GlideUpdateManager2();
updateSet.saveRecord(current);
//Push the Database view tables into current update set
var dbViewTablesList=[];
var dbViewTables = new GlideRecord('sys_db_view_table');
dbViewTables.addQuery('view', current.sys_id);
dbViewTables.query();
while (dbViewTables.next())
{
updateSet.saveRecord(dbViewTables);
dbViewTablesList.push(dbViewTables.getValue('sys_id')); // To avaoid Nested Glide Query
}
//Push the Database view Tables Fields into current update set
if(dbViewTablesList.length > 0)
{
var dbViewTableFields = new GlideRecord('sys_db_view_table_field');
dbViewTableFields.addQuery('view_table', 'IN', dbViewTablesList.join(','));
dbViewTableFields.query();
while (dbViewTableFields.next())
{
updateSet.saveRecord(dbViewTableFields);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-02-2018 06:25 PM
- This UI Action wont work in Scoped Apps.
How it Looks:
//Push the Database view basic info into the current update set
var updateSet = new GlideUpdateManager2();
updateSet.saveRecord(current);
//Push the Database view tables into current update set
var dbViewTablesList=[];
var dbViewTables = new GlideRecord('sys_db_view_table');
dbViewTables.addQuery('view', current.sys_id);
dbViewTables.query();
while (dbViewTables.next())
{
updateSet.saveRecord(dbViewTables);
dbViewTablesList.push(dbViewTables.getValue('sys_id')); // To avaoid Nested Glide Query
}
//Push the Database view Tables Fields into current update set
if(dbViewTablesList.length > 0)
{
var dbViewTableFields = new GlideRecord('sys_db_view_table_field');
dbViewTableFields.addQuery('view_table', 'IN', dbViewTablesList.join(','));
dbViewTableFields.query();
while (dbViewTableFields.next())
{
updateSet.saveRecord(dbViewTableFields);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-02-2018 06:28 PM
Thanks for the suggestions, I will try this and let you know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-02-2018 06:41 PM
Thank you This solution works great. I just moved my Update set to another instance for testing and did not see any problem.
Only Problem I saw is that if you click the UI action Multiple times, it will push the same entity into the update set as a customer update making it a duplicate, which may not be a problem at all. This can be used as a Quick and Dirty way to move Database view to update sets.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-25-2021 01:17 PM
sys_ui_view_list this is the table where Views are saved, the View can be searched there, selected and using related links, force it to updateset