- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
05-03-2025 10:45 AM - edited 05-03-2025 10:46 AM
Creating a custom button to save a form in ServiceNow Workspace may seem straightforward, but using it g_form.save()
incorrectly can result in script errors and UI action failures. This article outlines the root cause.
Problem Overview
I created a custom "Save" button on a form inside a Workspace page. Unlike the default Save behavior, this button had to:
-
Save the form record,
-
Close the form view,
-
Redirect the user back to the list view.
However, upon clicking the button, the following errors appeared in the browser console:
Overwriting extension point: g_validation_script_field_count
SCRIPT:EXEC Error while running Client Script "GlideScopedScript": TypeError: g_form.save(...).then is not a function
(g_form) [NOACTION] Could not find UI Action: [UI Action sys_id]
The form was not saved or redirected as expected.
Solution
After investigating, the workaround was:
-
Deactivate the custom UI Action we had created for the form save.
-
After deactivating the custom, the default Save button will be visible again in the form, which restores the native behavior expected by the Workspace runtime.
Final Thoughts
Workspace provides excellent flexibility, but also introduces architectural changes under the hood. Reusing platform-native behaviors can save time and reduce bugs, especially when dealing with standard form actions like Save or Submit.