Service Portal: Submit button gets stuck on "Submitting..." when Business Rule aborts the record ins
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
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:
- I have a Record Producer with an onSubmit Client Script that performs a confirmation dialog using g_modal.confirm.
- When the user clicks "OK", g_form.submit() is called.
- A Before Business Rule on the server-side validates the data and executes current.setAbortAction(true) with gs.addErrorMessage() if the validation fails.
- 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.