MicroStrategy ONE
Adding Custom JavaScript
Some customizations require the use of JavaScript to be included on a MicroStrategy Web page. The plug-in architecture provided by MicroStrategy Web can be used to achieve this purpose. The rules for adding JavaScript to a page are as follows.
-
The JavaScript should be included in its own file rather than including it directly on a MicroStrategy Web page.
-
The JavaScript file should be inside the "javascript" folder of the customization plug-in.
-
The JavaScript file should follow a naming convention such that the name of the file is [Name of the page]Page.js where [Name of the page] is the MicroStrategy Web page on which the JavaScript should be executed. For example, JavaScript to be included on a Report Execution page should in reportPage.js, while JavaScript to be included on the Folder Browsing page should be sharedPage.js. You can use the Web Customization Editor to find out the name of the MicroStrategy Web page.
-
To execute the JavaScript on all or majority of MicroStrategy Web pages (such as Prompt or Subscription pages), the JavaScript file should be named global.js. It is recommended that you use a condition in global.js so that the JavaScript is executed only on those MicroStrategy Web pages where the condition is met.
-
When using JavaScript for prompt customizations, include the JavaScript in reportPage.js and rwdPage.js so that the prompt customization is implemented on the Report Execution as well as on the Document Execution page respectively.
Using the Web Customization Editor to create a plug-in for JavaScript customizations
MicroStrategy SDK provides a Web Customization Editor that can be used to create a customization plug-in. The following steps guide you in creating the plug-in for adding custom JavaScript to a Report Execution page.
-
Create a new plug-in and give it a meaningful name. For example: CustomPromptNumbering.
-
Modify the JavaScript (.js) file for the MicroStrategy page you want to customize.
- Navigate to the JavaScript file. For example, if you want to customize the Report Execution page, navigate to Pages -> Reports -> JavaScript.
-
Open the JavaScript file.
-
Right-click on JavaScript and select Create New JavaScript.
- Click Next.
-
Click Finish.
- The JavaScript file opens in the Web Customization Editor. For example, if you are customizing the Report Execution page, reportPage.js opens.
-
- Make modifications to the JavaScript file.
-
Save your changes.
-
Launch MicroStrategy Web to view this customization.