Do you want to Save changes a alert with Save/Discard buttons. On click of save I want the field values to be saved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2022 12:22 AM
Hi All,
In Custom scoped application, when I do changes in the form portal side and moving out facing an alert "Do you want to save your changes " with save and discard buttons. So my requirement is to save the fields when I click on sav button in the alert. Please give me some brief over this functionality.
Thanks in advance!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2022 08:56 PM
This article might help you.
https://community.servicenow.com/community?id=community_article&sys_id=131c1b011bbc50107a5933f2cd4bcb65
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2022 09:28 PM
Can you let me know in your portal are you using a Form widget to display your form or it is a custom written widget all together?
If it is a Form widget then you can simply write a Client Script and use the link below which shows several methods on how you can display the popup and on confirmation you can save the form:
https://servicenowguru.com/scripting/client-scripts-scripting/javascript-popup-boxes-servicenow/
So in your scenario it can be a on Change or an On Submit client script and a sample script shared below:
function onSubmit() {
var priority = g_form.getValue('priority');
if (priority == 1)
return confirm('Submit a priority one ticket?');
}
Make sure to select the Run as to All in your client Script.
In case if it is a Custom widget then there are couple of ways you can try this:
1) Make use of $watch to identify the field changed and then throw a popup anc ask for confirmation from the user.
2) Try the approach given in below link:
https://community.servicenow.com/community?id=community_article&sys_id=ceac0245db6954505129a851ca961933
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 01:50 AM
Hi,
Actually we are using form widget but alert i am facing is OOB Dirty form support popup having save and discard buttons. How to save the form when user clicks on save in the alert.