1
votes

If I use

context.redirectToPrevious()

It works great, but If I call an xagent with or without state between opening the document and doing a close of the document. I end up navigating to the xagent. And If I go directly to the view behind I loose opened categories in the view.

Is there a way to block an xpage to end up in the navigation/history tree?

1
Can you use context.getHistoryUrl(x) and set x to 2 to get to the 2nd to last page? - Per Henrik Lausten

1 Answers

2
votes

There are two approaches that would work.

The first is to use client-side JavaScript to open the XAgent. How you handle that will depend on whether there are values set in the browser that you are passing to sessionScope for the XAgent to use. If not, you can just use client-side JavaScript to open the relevant XAgent page. If you do need values, there are two options:

  1. Pass them as query string parameters to the XAgent instead of storing them as sessionScope variables.
  2. Perform a partial refresh to store the values in sessionScope and open the XAgent page via client-side JavaScript either in the onComplete() event (will trigger every time) or using view.postScript(), passing the relevant CSJS as a string (will only trigger if validation is successful).

The second is to set the previous page in the beforePageLoad event and then use that value in context.redirectToPage().