Alert message in the OnSubmit client script is triggering even after submitting the record

Manasa23
Tera Contributor

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



 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Manasa23
Tera Contributor

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

Hi Manasa,

Looks like both Save and Load all records button have inbuilt save functionality

 

Check there is below method OOTB in the "Load all records"

current.update();

find_real_file.png

 

Thanks

Chandu Telu

Please mark the answer is correct/helpful , if it helps

Manasa23
Tera Contributor

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