brian_degroot
ServiceNow Employee

When you submit a record, the form is set to read only and the submission actions are blocked. When the server is done processing, there is a slight window between the new page and the unload event of the current page where if you click on the button in that timeframe, the form is enabled and able to be clicked on thus creating the duplicate record.



Since the issue is UI related, an alternate solution to this can be to hide the submission actions when the form is submitted. This would essentially eliminate the possibility of this happening. You can do this through an onSubmit() Client Script on the task table using the following code:



// This script will hide the Submit UI Actions when a form is submitted


function onSubmit() {        


              var hideMe = document.getElementsByTagName("button");  


              if (hideMe) {  


                      for (var i=0; i < hideMe.length; i++) {  


                              var testClass = hideMe[i];


  var t1 = 'form_action_button   action_context btn btn-default'   // these are the class of buttons that appear at the top of the form


  var t2 = 'form_action_button header   action_context btn btn-default' //these are the class of buttons that appear at the bottom


              if ((testClass.className == t1 || t2 )   && (testClass.id == 'sysverb_insert'))


                          hideMe[i].style.display = 'none';                  


          }


    }  


}