Record Producer's Sumbit button is "Submitting..." state and does not revert back to the original st

Ohki_Yamamoto
Tera Guru

Use spModal on catalog client script for onsubmit of record producer.

When the submit button is pressed from the record producer, spModal is invoked and a confirm is displayed indicating OK/Cancel.

After the OK button is pressed once here, a validation check is performed by the business rule before, and if there is an error, the control is made to return an error to the record producer (the record is not created).

After the above error is returned to the record producer, if the submit button is pressed again and Cancel is pressed on spModal, the submit button on the record producer will return "Submitting...". on the record producer will remain inactive with "Submitting..." and the button will not become active.

Ohki_Yamamoto_0-1691643649213.png

 

The above problem occurs when the submit button is clicked on the record producer once and then Cancel is clicked on spModal after an error is passed through the server process (business rule).

 

Do you have any ideas as to the cause?
Is it a glitch in ServiceNow's OOTB?

 

The script running onSubmit in the catalog client script is as follows A sample is excerpted below.

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

function onSubmit() {
    var actionName = g_form.getActionName(); //submit

    spModal.open({
        title: "",
        message: 'message'
    }).then(function(confirmed) {
 
        g_form.submit(actionName);
        return false;
    });

    return false;
}

 

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

 
3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Ohki_Yamamoto 

if the validation passes is the user able to submit the form?

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

@Ankur Bawiskar 

Yes, if it passes validation, it can be submitted.

This issue occurs when the Cancel button is pressed on confirm in spModal when the record producer tries to submit again after an error in the server process (business rule).

@Ohki_Yamamoto 

Seems this line is the issue

function onSubmit() {
var actionName = g_form.getActionName(); //submit

spModal.open({
title: "",
message: 'message'
}).then(function(confirmed) {

g_form.submit(actionName);
// return false; // since you are submitting from above line you can comment this line
});

return false;
}

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