Best way to change form layouts using scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 01:18 PM
I have been playing with form customization using scripts by changing data on sys_ui_form, sys_ui_view, etc. It works but I wonder if there are any available api or script include that can help with this. Found "ViewManager" script include but was not able to successfully use it. Also, could not find any reference to GlideScriptViewManager that is used by the script include.
So, in summary, my questions are:
- Is there a best practice to programmatically work with form layouts? Examples of uses: add a field on several forms, copy the form from a table to other tables, etc
- Can someone provide more information on GlideScriptViewManager ?
- Can someone provide examples on how to use VIewManager script include?
Thank you all in advance.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 01:48 PM
So "GlideScriptViewManager" was created when they got rid of most if not all of the Package calls. Conveniently a lot of them where not documented. So all you can do is enumerate the methods and see what you get.
https://docs.servicenow.com/bundle/paris-application-development/page/script/general-scripting/concept/c_PackagesCallRemovalTool.html
As for programmatically working with a form layout I would say its not worth the squeeze in my opinion. ServiceNow could change the formatting and/or how they do it at any upgrade which would leave you having to redo the whole thing. Unlikely but possible.
In all of the years that I have been doing this I have yet to hit a point where I have wanted a way to copy a form. As for adding a field to multiple forms I have always needed to add it in different places on each form and since it does not take that long I have always found it just quicker to add it manually.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2024 01:02 PM
Did you ever find a way to do this?