Can you redirect to the previous page after a save or cancel?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I am wondering if the page you redirect to after a save or cancel can be set to "whatever page was before this one". 

Use case -- 

My users often use their task list (a modified version of the home page) to work through their tasks. E.g, 
  • Start at task list on hompepage
  • Click on task name to navigate to task detail page
  • Edit, complete, save task
  • Go back to task list on homepage
  • Begin again
However sometimes they may be working on a specific contact with multiple operations: 
  • Start on contact detail page
  • create new follow up task
  • Go back to contact detail page to do something else
In both cases the user wants to go back to the page they were before the task page to continue doing something. But the page title component only lets me put a single URL, albeit one with dynamic tokens. 

Is there a token for "page that was before this one"? 

Thanks! 
Photo of Justin Norris

Justin Norris

  • 782 Points 500 badge 2x thumb

Posted 4 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,674 Points 20k badge 2x thumb
How is the page you're redirecting from being navigated? Can you pass a URL parameter into the page to use as your redirect ID?

"/{{$Param.redirId}}"
(Edited)
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,674 Points 20k badge 2x thumb
Oh. sometimes from the home page. I see. hmmmm .... I'm sure you can get the browser history, but I'm not sure to do that myself.
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
Use a javascript snippet with the following content:

window.history.back();
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,674 Points 20k badge 2x thumb
See.... javascript. Can't wait til it comes to me that easily. A one liner snippet!

I sometimes feel as though I'm playing t-ball and wildly swinging the bat way too high over and over .....  :( It's really hard to miss in t-ball for anyone with arms.

I'm still typing with my nose. :P
(Edited)
Photo of Justin Norris

Justin Norris

  • 782 Points 500 badge 2x thumb
@Moshe, that is awesome -- thanks!

Just to clarify, would I leave the "redirect after save" field in the page title blank, and then for the save button, run multiple actions that would first save the model, then call the javascript snippet? 

Thanks again. 
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Your clarification is correct.  Use a multiple actions sequence for the button...