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.

  1. The JavaScript should be included in its own file rather than including it directly on a MicroStrategy Web page.

  2. The JavaScript file should be inside the "javascript" folder of the customization plug-in.

  3. 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.

  4. 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.

  5. 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.

  1. Launch the Web Customization Editor.

  2. Create a new plug-in and give it a meaningful name. For example: CustomPromptNumbering.

  3. Modify the JavaScript (.js) file for the MicroStrategy page you want to customize.

    1. Navigate to the JavaScript file. For example, if you want to customize the Report Execution page, navigate to Pages -> Reports -> JavaScript.
    2. Open the JavaScript file.

      1. Right-click on JavaScript and select Create New JavaScript.

      2. Click Next.
      3. Click Finish.

      4. The JavaScript file opens in the Web Customization Editor. For example, if you are customizing the Report Execution page, reportPage.js opens.
    3. Make modifications to the JavaScript file.
    4. Save your changes.

  4. Launch MicroStrategy Web to view this customization.