Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Service Portal: Submit button gets stuck on "Submitting..." when Business Rule aborts the record ins

RyoyaFukuda
Tera Contributor

Hi everyone,

I am facing a persistent issue in Service Portal (Record Producer) where the "Submit" button gets stuck in the "Submitting..." state after a server-side Business Rule aborts the submission.

Scenario:

  1. I have a Record Producer with an onSubmit Client Script that performs a confirmation dialog using g_modal.confirm.
  2. When the user clicks "OK", g_form.submit() is called.
  3. A Before Business Rule on the server-side validates the data and executes current.setAbortAction(true) with gs.addErrorMessage() if the validation fails.
  4. The form correctly shows the error message and stays on the page.

The Problem:
After the error message appears, if the user corrects the input and clicks "Submit" again, or if the user clicks "Submit" and then clicks "Cancel" on the confirmation dialog, the button remains in the "Submitting..." state and becomes unresponsive. It seems like the internal submission flag of the Service Portal widget is not being reset when the server-side abort occurs.

My Constraints:

  • I cannot include validation logic in the onSubmit script itself because this script is stored in a Variable Set used across multiple Record Producers, so it must be generic.
  • I am looking for a way to handle this button state issue without making complex modifications to the widgets or the platform internals, if possible.

Current Implementation:

function onSubmit() {
    if (g_scratchpad.submitFlg == null) {
        // First pass: Show confirmation popup
        getMessage("Confirmation", function(title) {
            getMessage("Submit Popup", function(msg) {
                g_modal.confirm(title + "<br><br>" + msg, function(confirmed) {
                    if (confirmed) {
                        // If OK is pressed, set submitFlg to '1'
                        g_scratchpad.submitFlg = '1';
                    } else {
                        // If Cancel is pressed, set submitFlg to '0'
                        g_scratchpad.submitFlg = '0';
                    }
                    // Trigger submit again
                    g_form.submit();
                });
            });
        });
        return false;
    } else {
        // Second pass: Evaluate logic based on submitFlg
        if (g_scratchpad.submitFlg == '1') {
            // Proceed with submission
            return true;
        } else {
            // Clear submitFlg
            g_scratchpad.submitFlg = null;
        }
        return false;
    }
}

Questions:

  • Is there a standard way to reset the "Submitting..." state in the Service Portal when a server-side abort occurs?
  • Are there any best practices for implementing a "Submit Confirmation" dialog in a Record Producer that co-exists well with server-side validation?
  • Is there an officially recommended approach for this common scenario?

Any insights or workarounds would be greatly appreciated.

Thank you.

6 REPLIES 6

@sachinvic 
I do not have the necessary permissions to view that knowledge article.
Could you share the content with me?

 

I’m also unable to open the Knowledge Article page from my end. Initially, I thought the issue might be specific to my side. However, could you please check the link below and confirm whether you’re experiencing the same issue?

https://www.findbugzero.com/operational-defect-database/vendors/sn/defects/PRB1919964

If this is not the problem in your case, I can suggest an alternative solution. Please check the link and let me know.

@sachinvic 

Thank you for sharing that information

I checked the PRB1919964 article. While the issue described there is very interesting, I suspect that in my case, the button getting stuck is caused specifically by the server-side Business Rule executing current.setAbortAction(true).

When the server aborts the submission, the Service Portal widget seems to lose its internal state management, leading to the "Submitting..." freeze.

I will definitely consider applying the workaround provided in the article to improve general form stability, but I am concerned that it might not resolve the specific state-lock issue caused by the server-side abort.

If that workaround doesn't fully resolve the state-lock issue, are there any alternative ways to "reset" the Service Portal form state or the submitting flag programmatically after a server-side abort?

I would appreciate any further suggestions you might have. Thank you for your continued help