MicroStrategy ONE

Processing Events with JavaScript before Submitting Them

There may be instances when you want to perform some custom processing when a user performs an action on a specific MicroStrategy Web page.  

In this customization scenario, you modify the <a> (anchor) tag to include an "onclick" attribute that executes JavaScript before an event is submitted for execution. The event in this scenario is any user action on the Folder Browsing page. You can include in the JavaScript code the logic for any action that should be performed before the request is submitted for further action. For illustrative purposes, the JavaScript in this scenario simply causes an alert window to be displayed.

You can write your own custom logic in the code sample to process an event.

This customization can be accomplished using either of the following methods:

Deploying the plug-in provided with MicroStrategy SDK

MicroStrategy SDK provides a plug-in (ZIP file) that can simply be extracted to thepluginsfolder to view the customization in MicroStrategy Web. The following steps guide you in locating the plug-in and deploying it. 

  1. Access the plug-in: JSP version or ASP .NET version.

  1. Copy the plug-in to the plugins subfolder inside the MicroStrategy Web installation folder. Extract the plug-in to the plugins subfolder inside the MicroStrategy Web installation folder.
     

  2. Launch MicroStrategy Web to view the customization.
     

Using the Web Customization Editor to create a plug-in

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 and deploying it. 

  1. Launch the Web Customization Editor

  2. Access the Transform Creation Wizard

  3. Click Browse... next to the Source folder text field to select the src folder and click OK

  4. Enter the following information for the rest of the text fields.:

    Package: com.microstrategy.sdk.samples.transforms
    Name
    : FolderViewTransformWithJSPreprocessing
    Transform description
    : This transform changes the anchor used for documents. The new hyperlink redirects to an external URL when a document is requested.
    Superclass
    : com.microstrategy.web.app.transforms.FolderViewTransform 

  5. Click Next

  6. Click the radio button for Uncheck all methods

  7. Click Next

  8. Click Finish. FolderViewTransformWithJSPreprocessing.java opens in the editor. 

  9. For this scenario, you override the generateAnchor(WebEvent event) method, and make other modifications as required. The sample, FolderViewTransformWithJSPreprocessing.java, contains the entire code for this custom transform. You can use this code in FolderViewTransformWithJSPreprocessing.java that is open for editing. 

  10. Save your changes. 

  11. Click on Styles in the Web Customization Editor to expand the list of styles used in MicroStrategy Web. 

  12. Double-click the FolderStyleIcon style. 

  13. Click the Change button next to the Transform text field. 

  14. Enter the name of the transform you created (FolderViewTransformWithJSPreprocessing), select it from the Matching Types results and click OK

  15. Save your changes. 

  16. Double-click the FolderStyleList style. 

  17. Click the Change button next to the Transform text field. 

  18. Enter the name of the transform you created (FolderViewTransformWithJSPreprocessing), select it from the Matching Types results and click OK

  19. Save your changes. 

  20. Launch MicroStrategy Web to view the customization.