Mobile Agent - Redirection after record creation

abardin
Tera Contributor

I have an action function that creates a new record in Mobile Agent. After this record is created, I want to redirect to the newly created record, rather than back to the list screen where the action is loaded from. I have been able to configure it to redirect to the screen I need it to, but I am not able to specify that I need it to redirect to the new record. It currently redirects to a different record in the same table I am creating the record on. @David Ha 

1 REPLY 1

mackinley
Tera Expert

Please check my reply to a similar question:

https://www.servicenow.com/community/mobile-apps-platform-forum/now-mobile-redirect-to-specific-reco...

 

Below is a copy of the reply as well.

 

 

 

There is no formal documentation on how to do this but they do have it in an example.

 

Here is the snippet from the documentation:

 

(function WriteBackAction(parm_input, parm_variable, actionResult) {​
  var gr = new GlideRecord('incident');​
  gr.get(parm_variable['sys_id']);​
  gr.short_description = 'Updated by Scripted Action';​
  gs.addInfoMessage(gs.getMessage("This is the First success message"));​
  gs.addInfoMessage(gs.getMessage("This is the Second success message"));​
  gs.addInfoMessage(gs.getMessage("This is the Third success message"));​
  gr.update();​
  // The below line is what you need.
  actionResult.setRedirectionInfo(gr.getUniqueValue(), gr.getTableName());
  // The above line is what you need.
})(parm_input, parm_variable, actionResult);

 

 

I think this will only work if the Action item has a Input form screen associated with it. Otherwise the `WriteBackAction` function parameters will only have `input`.

 

I also have the following set to true on the Function record that invokes the Action item but I haven't tested exactly what is required:

  - Jump to screen after successful action completion

  - Jump to screen without user interaction

  - Auto-populate screen parameters

mackinley_0-1747401423652.png

 

Link to latest version of doc:

https://www.servicenow.com/docs/csh?topicname=sg-studio-create-action-item.html&version=latest