gsftSubmit UI Action not working

ianbradley
Tera Contributor

Dear Experts,

This one has me stumped.  Just trying to overwrite a submit form button in order to do a record count check.  The call to the script include works fine and issues the alert if required.  But, the server code never runs.  Any help would be appreciated!

Thanks - Ian B.

function Submit() {

   var ga = new GlideAjax('Count_Tasks');
   ga.addParam('sysparm_name', 'getRecordCount');
   ga.addParam('sysparm_table', g_form.getValue("test"));
   ga.getXMLAnswer(_handleResponse);

   function _handleResponse(response) {
      if (response >= 0) {
         alert("There are too many tasks to process given the current data parameters");
         return;
      }
      else {
         gsftSubmit(null, g_form.getFormElement(), 'Submit Test');
      }
   }
}

if(typeof window == 'undefined')
   u_runServerCode();

//Server-side function
function u_runServerCode(){
   gs.addInfoMessage('before save');
   answer = current.insert();
   gs.include('ActionUtils');
   var au = new ActionUtils();
   au.postInsert(current);
   action.setRedirectURL(current);
}

 

find_real_file.pngfind_real_file.png

1 ACCEPTED SOLUTION

MrMuhammad
Giga Sage

Hi,

Replace the third parameter of gsftSubmit from UI Action Name to Action Name.

gsftSubmit(null, g_form.getFormElement(), 'sysverb_insert');

Regards,

Muhammad

Regards,
Muhammad

View solution in original post

1 REPLY 1

MrMuhammad
Giga Sage

Hi,

Replace the third parameter of gsftSubmit from UI Action Name to Action Name.

gsftSubmit(null, g_form.getFormElement(), 'sysverb_insert');

Regards,

Muhammad

Regards,
Muhammad