The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Client Script - Save form before Redirect

Daryll Conway
Giga Guru

I have set-up a redirect from an on-submit client script but I need to save the form before I redirect, currently this just hangs.

Here is my client script...

function onSubmit() {

      if(g_form.getValue("assignment_group") == "a4429af10a0a3c2800b1bc67f7b415c0" && (g_form.getValue("incident_state") == 6 || g_form.getValue("incident_state") == 7)){

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

              var URL = "<my_url>.do?uri=u_sys_eng_questionnaire.do";

              alert("You are being redirected to the Systems Support Questionnaire");

              top.window.location = URL;

      }

Can anyone suggest why this hangs and/or a better way to do this?

1 ACCEPTED SOLUTION

Talking about the UI action made me think why don;t I do this in the UI Action rather than a client script so I've done this ...



if(current.assignment_group != "a4429af10a0a3c2800b1bc67f7b415c0" && (current.incident_state != 6 || current.incident_state != 7)){


      action.setRedirectURL(current);


      current.update();


}


else{


      var URL = "https://enxdev.service-now.com/nav_to.do?uri=u_sys_eng_questionaire.do";


      action.setRedirectURL(URL);


      current.update();


}



Which works however it loads like this ...



find_real_file.png



How can I get this to load just as the page I want and not with the banner and side bar duplicated?


View solution in original post

12 REPLIES 12

Kalaiarasan Pus
Giga Sage

Check the code of this button with the actionname 'sysverb_update_and_stay'.. I think that's update UI action


I think that maybe the issue I'm calling the update and it calls this script again


Between what is the code on the update button ? Just the out of the box current.update()


My UI Action "Save" does this



action.setRedirectURL(current);


current.update();