Save form in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2025 04:42 PM
Hi All,
I am using a on change client script on priority field (incident) in workspace to show few fields using modal. Once all fields are filled and clicked ok, the information is passed to a script include to send few notifications. But the form is not saving. Do I need to save record in client script or script include?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2025 07:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2025 08:40 PM
what's the business requirement for this?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2025 09:15 PM
Hi @pramodkumar ,
When you use an onChange client script in ServiceNow Workspace to display a modal, collect additional info, and then trigger a Script Include for notifications, you may notice the incident form does not automatically save after the workflow completes.
Workspace client scripts do not automatically save the record when fields are changed, modals are submitted, or notifications are sent via Script Includes.
Script Includes always run server-side and do not have access to the active form in the user’s browser session, so they cannot directly save the record.
You should trigger the save action from your client script. The user's browser and UI session manages the current state; a Script Include can’t save the form the user is editing unless you pass all the latest data in the request.
use the following approach in your client script after processing the modal and before or after calling your Script Include (depending on logic).
// Example: Save the current form in Workspace
g_form.save();
If you want to call the Script Include after saving (to ensure all data is committed), consider using a GlideAjax callback.
Thanks,
Bhimashankar H
-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & ' Correct' Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2025 05:24 PM
Hi @pramodkumar ,
I hope you saw my reply.
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. It will help future readers as well having similar kind of questions and close the thread.
Thanks,
Bhimashankar H