Reload Form On Click Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2013 02:38 PM
Hi,
I want to get some alert when Reload Form is clicked through Right-Click UI Action. But, not able to figure out on how to get know when reload form is clicked.
Can anyone please help me out with script?
Thanks & Regards,
Amisha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2013 09:57 PM
You could create a new UI action, but the original "reload form" button will still behave the same.
Anyway, if you wanted to test, something like this would work:
Create a new UI action:
Action Name: reload.prompt.form
Client: true
On Click: onClick()
Script:
function onClick() {//this function will be run client side
var answer = confirm("Are you sure you wish to reload?");
if (answer == false) { //only continue if the user selects OK from the confirm box
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'reload.prompt.form');
}
if (typeof window == 'undefined') {
reloadForm();
}
function reloadForm() {//this function will be run server side
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2013 10:32 PM
Hi Daniel,
Thanks for your reply.
But, creating new UI Action will result in having 2 Reload Form UI Action. as OOB is not really available in UI Action, cannot disable it.
Any thoughts?
Regards,
Amisha Parekh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2013 02:48 AM
To remove the OOB "Reload" form context menu option, you could comment out the following line of code in "context_form_header" UI macro:
gcm.addHref("${gs.getMessage('Reload form')}", "reloadWindow(window);");
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2013 02:54 AM
Normally, ServiceNow displays a warning message when you try to navigate away from a form if you made any changes and did not save them. This behavior is controlled by glide.ui.dirty_form_support system property. Does it sound similar to what you are actually trying to achieve?
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/