Use Navigation APIs
As an application designer or story developer, you can use navigation APIs to let end users navigate from one analytic application or story to another application or a specific page of a story in view time.
You can define the target story or analytic application to navigate to, parameters to append to its URL, and whether to open it in a new tab by using the following APIs:
Code Syntax
NavigationUtils { openStory(storyId: string, pageId: string, parameters ? : UrlParameter | UrlParameter[], newTab ? : boolean): void openApplication(appId: string, parameters ? : UrlParameter | UrlParameter[], newTab ? : boolean): void createStoryUrl(storyId: string, pageId: string, parameters ? : UrlParameter | UrlParameter[]): string createApplicationUrl(appId: string, parameters ? : UrlParameter | UrlParameter[]): string openUrl(url: string, newTab ? : boolean): void }
Note
We highly recommend you specify the desired mode for the target application or story via the URL parameter in the API.
Sample Code
NavigationUtils.openStory("story_id", "page_id", UrlParameter.create('mode','embed'),false); NavigationUtils.openApplication("application_id", UrlParameter.create('mode','embed'),false); NavigationUtils.createStoryUrl("story_id", "page_id", UrlParameter.create('mode','embed')); NavigationUtils.createApplicationUrl("application_id", UrlParameter.create('mode','embed'));
For a list of display parameters, see Use Application URL and Open Story URL.
Example
If you want to let users go to a specific page in a story when they click a button, and the story will be opened in view mode with
123 assigned to script_var_1, write the following script for the button:
Sample Code
NavigationUtils.openStory("story_id", "page_id", [UrlParameter.create('mode','view'), UrlParameter.create("p_script_var_1", "123")],false);
In the script above, you don’t need to enter story ID and page ID manually. By entering Ctrl + Space , you can open the value help. Choose Open story selector, and you can go to My Files and select the corresponding story.