Skip to main content
Ends the run and opens another action in the same browser tab, e.g. the detail of the record the action just created.

Usage

Import the action you want to open and ask it for its route. Its params are typed by that action’s params schema:
actions/accounts/createAccountAction.ts
The browser opens /actions/accounts/extend_trial?company=Acme+Inc. and Extend trial starts with ctx.params.company filled in.

Routes

action.route() returns the link to that action, an ActionRoute. The same object is what a table’s row menu lists, so one action can be opened from a redirect and from a table alike:
An action without a params schema takes no params: clearCacheAction.route(). When every param of its schema is optional, the params can be left out too: createIntegratorAction.route({ label: 'Create integrator' }). route() works once listen() has loaded the actions folder, so call it inside a handler, not at the top of a file.

Behaviour

  • The run ends with the redirect: the run page opens the other action instead of showing a result, and Back skips the finished run.
  • The handler goes on after await ctx.redirect(), but any io call after it throws, like after a cancel, and what it returns is ignored. Put the redirect last.
  • After the run has ended, the call does nothing.