Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

action.setRedirectURL(current) not working on UI Action

Zod
Giga Guru

HI,

while using an ui action I face to strage issues:

1. the   "action.setRedirectURL(current);" does not do its job - I always leave the form after the change is done ...

2. I'm using the   g_form.submit(); as this one woks - using   g_form.update(); also changes the value, but not actually saving it ...

function clickedReview() {

  g_form.setValue('ifieldname',value);

  g_form.submit();

  action.setRedirectURL(current);

}

Any Hint on this?

1 ACCEPTED SOLUTION

snehabinani26
Tera Guru

Hi Venffm,



This works in server side script of Ui Action.


Please move this to server side script and validate.




find_real_file.png


View solution in original post

5 REPLIES 5

Hi,



I have a "reopen problem" UI action as below:



function reopenProblem(){


  //g_form.setValue('problem_state',2);


  gsftSubmit(null, g_form.getFormElement(), 'reopen_problem'); // MUST call the 'Action name' set in this UI Action



}



if (typeof window == 'undefined')


    serverProblemReopen();



function serverProblemReopen() {


  current.problem_state = 2; //Assigned


  current.active = true;



  current.setWorkflow(false);


  current.update();


  action.setRedirectURL(current);



}



It is working fine with google Chrome but failing to update and redirect with Firefox and Internet Explorer



Would anyone know why ?



Thanks


Kind regards,



Agathe