Business Rule to abort action not redirecting back to same record

SC10
Kilo Guru

I have a Business Rule running during update, with "When" as "Before", on the the sc_task table:

(function executeRule(current, previous /*null when async*/) {

  if(current.variables.offboard_desktoprecoverassets == '' && current.state == "3"){

   

  current.state=previous.state;

  current.setAbortAction(true);

  gs.addInfoMessage('NOTICE: Please select an option for desktop recovery below completing the task.');

  gs.setRedirect(current);

  }

})(current, previous);

Everything seems to working as the state changes back to Open (the previous state on a new catalog task), the info message comes up on the screen, but my redirect is not working.

6 REPLIES 6

jamesjurden
Giga Guru

This doesnt work for me - still leaves page

var url = gs.getProperty("glide.servlet.uri") + gs.action.getGlideURI();

gs.addErrorMessage("Error message");
current.setAbortAction(true);
gs.setRedirect(url);

Community Alums
Not applicable

gs.setRedirect("/".concat(current.sys_class_name,".do?sys_id=",current.sys_id));