What tables are used to hold a view on a form

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-29-2022 02:05 PM
I am trying to programmatically create the Default view on a form if it doesn't already have the view defined.
I know there are many tables involved and I haven't been able to find all of the tables involved.
grNewView = new GlideRecord('sys_ui_view');
grNewView.initialize();
grNewView.setValue('name', viewName.toLowerCase().replace(/ /g, "_"));
grNewView.setValue('title', viewName);
grNewView.setValue('sys_scope', 'Global');
grNewView.insert();
grViewUI = new GlideRecord('sys_ui_form');
grViewUI.initialize();
grViewUI.setValue('view', 'data_export_view');
grViewUI.setValue('name', 'u_data_export_repository');
grViewUI.setValue('sys_scope', 'Global');
grViewUI.insert();
Has anyone ever added a view dynamically via Java Script to a table/form? I could really use a hand with this.
Thank you for your help,
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-29-2022 03:04 PM - edited ā11-29-2022 03:08 PM
Hi Dave,
as far as I remember it (was long time ago to be frank), I think I used something OOB, kind of hidden/undocumented Glide class.
In my "cheat notes" I found this:
TableEditorAjaxProcessor - script include name
GlideSysForm.generateDefaultForm(tableName); - what I used for that.
Can you give it a try and let me know if I am correct ?
P.S. For related list - check script include SysList
Cheers,
Joro

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-02-2022 07:46 AM
Good Morning Joro
I got sidetracked and have not had a chance to test your suggestions although, I did look for documentation and found none.
My partner did find a solution to our real issue which was being able to add a related list by using the following:
var table = new GlideTableHierarchy(_activeTable);
var tableTree = table.getTables();
You can look this up in the Scoped Server APIs.
Thank you for your time!
Dave