Navigate Back
Introduction
The Navigate Back customization enables you to control navigation behavior when tasks are completed or cancelled. Portal automatically returns users to their previous location (homepage, task list, etc.), but you can implement custom navigation logic for specific scenarios using the PortalNavigatorInFrameAPI to redirect users to designated URLs or custom pages.
Default Behavior
When a task is completed, Portal navigates back to the previous page. For example:
If a task is started from the homepage, it redirects to the homepage
If a task is started from a task list, it redirects to that task list after the task is finished
Custom Navigation
If your project has a navigation button that does not finish a task (e.g., Cancel), you have to implement one of the following:
Previous page: Use
PortalNavigatorInFrameAPI.navigateToPortalEndPage()A specific URL: Use
PortalNavigatorInFrameAPI.navigateToUrl(String url)
Warning
Never pass unsanitized, user-controlled input directly as the url parameter.
Both navigateToUrl() and resetTaskAndNavigateToUrl() internally URL-decode
the value and escape it for JavaScript context via SanitizeAPI.escapeForJavascript().
However, you should still validate the URL at the application boundary (e.g., check that
the scheme is http or https) to prevent open-redirect or protocol-injection attacks.
Reset Task and Navigate
To reset a task and navigate to a URL, use the following approach:
PortalNavigatorInFrameAPI.resetTaskAndNavigateToUrl("https://example.com/custom-page");
Alternatively, if the task is not in the CREATED state and has not been persisted, you can use the following approach:
ivy.task.reset();
PortalNavigatorInFrameAPI.navigateToUrl("https://example.com/custom-page");