There are some scenarios where you want to prevent a user from proceeding to a page and instead force them to go back to where they started. It could be scenarios where they need to complete other things first, or maybe they don’t have a specified permission to proceed to a given page. You can force the user to navigate back by executing a crt.7XRequest request with an action of BackHistoryState.
if (someCondition) {
Terrasoft.showInformation("You can't be here");
await request.$context.executeRequest({
type: "crt.7XRequest",
action: "BackHistoryState",
$context: request.$context,
});
}
The end result will be that the user will click something to go to a page, but then instead sees the message. It all happens quickly, the user won’t even see the page load. A little flash and then the message displays.
A note about the crt.7XRequest. This request allows you to do a this.sandbox.publish sandbox message as you would in classic pages. It’s a stop-gap for doing things that there might not be a complete Freedom UI request equivalent yet.
The above is the classic equivalent of the following:
this.sandbox.publish("BackHistoryState");



