Alert message in the OnSubmit client script is triggering even after submitting the record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2022 01:22 AM
HI,
I have written below onSubmit client script to trigger the alert message when the user clicks on SAVE Button(UI action),
which is working fine, but the alert message is triggering even after saving the form.
function onSubmit() {
alert("Validation is in Progress, an email will be triggered after Successful Validation");
we have one more UI action button in the table (Load all records), When the user clicks on the load all records, alert message is triggering.
Ideally it has to trigger only once before saving the record.
Kindly help !!
Regards,
Manasa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2022 01:43 AM
Hi,
is that UI action trying to save the form using g_form.save()?
If yes then onSubmit would trigger
Share the UI action code.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2022 01:56 AM
HI Ankur,
thanks for the reply !!
Below is the code for the UI Action "Load all records", we have not written save() in the code, kindly help !!
if (current.u_select_the_type_of_action == "allocation_deallocation") {
var redirectStr = "sys_import.do?"; // the URI
redirectStr += "import_source=data_source"; // this is a Data Source import
redirectStr += "&sysparm_data_source=" + gs.getProperty("HAM.sys_id.allocation_Deallocation"); // the sys_id of allocation_Deallocation
redirectStr += "&sysparm_tablename=" + gs.getProperty("HAM.import_set_table_name.allocation_deallocation"); // always create the same test
redirectStr += "&sysparm_recreate_table=false"; // we dont want to overwrite existing
redirectStr += "&sysparm_tablelabel=" + gs.getProperty("HAM.name.allocation_deallocation");
redirectStr += "&create_new_module=ON";
redirectStr += "&sysparm_extends=sys_import_set_row"; // always extends this
redirectStr += "&selected_application=import_sets";
gs.setRedirect(redirectStr);
}
Regards,
Manasa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2022 02:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2022 02:15 AM
Thanks chandu for the reply !!
we need to get an alert / info kind of message before saving the form, how to achieve this other than Onsubmit client script , can someone please suggest ??
Regards,
Manasa