EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

Add a Hyperlink to a MicroStrategy Error Message


Community Admin

• Strategy


This knowledge base article details how to add a hyperlink to a MicroStrategy error message.

Description

Let's add a hyperlink to a Strategy error message. First, you must determine whether it is possible to add a hyperlink to an error message.
Let's use the following error message as an example:


"Your request could not be processed due to a server error. Please try again. If the problem persists, contact the server Administrator.
(Maximum number of result rows retrieved per report was exceeded.[Maximum number of result rows retrieved per report was exceeded. 5000000 , it is set for report ffsqlReport]Error in Process method of Component: QueryEngineServer, Project Strategy Tutorial, Job 85, Error Code= -2147205488.)"

Solution

  • Inspect the error message using your browser developer tools to find out if this error message uses a transform that you can extend. In this example, the error message uses the following transform:
    
    Class: com.Strategy.web.app.transforms.ReportDetailsXHTMLTransform
    Method: transformForRequestInError

  • Using your browser developer tools, find out which style is connected to ReportDetailsXHTMLTransform. In this example, it is using reportDetailsStyle. Remember the name of the style, since you need to locate it in Eclipse and tell it to use a custom transform instead.
  • In Eclipse, create a custom transform that extends ReportDetailsXHTMLTransform.
  • Implement the method you are interested in manipulating. When it is called, allows the original logic to execute before checking what out contains.
    
    transformForRequestInError(MarkupOutput out) {
      // check if there was anything before the rendering in this fn
      String beforeRender = out.getCopyAsString();
      
      // let the original fn do the rendering, this will store something new in "out"
      super.transformForRequestInError(out);
      
      // check what changes happened
      String afterRender = out.getCopyAsString();
      
      // print both variables and compare them, what do they contain?
    }

  • In Eclipse, navigate to Application Settings > Strategy Web Configuration > Styles. Double-click on reportDetailsStyle to change the style to use your custom transform created in step 3, instead of ReportDetailsXHTMLTransform. It renders the entire container, which is the error box <div>, and not just the error message itself.
ka0PW0000000qTFYAY_0EM2R000000mGzC.jpeg
  • Look for functions you can override. In this example it is one of three displayError functions. All three the displayError functions have a MarkupOutput parametet, so they must be responsible for rendering something. They also have string parameters, so you can check if the parameters include the error message.
ka0PW0000000qTFYAY_0EM2R000000mGzW.jpeg
  • Log the contents of MarkupOutput before calling the original methods.
  • Log the contents of any string parameters, before calling the original.
  • Print out the message to see if it renders just the error message, as shown below.
    
        protected void displayError(MarkupOutput out, String className, String methodName, Exception e, String title, String message,
               boolean addContactInfo) {
           // TODO Auto-generated method stub
      
            super.displayError(out, className, methodName, e, title, message, true);
        
          System.out.println("message: " + message);

  • Your final displayError method should appear as shown below.
    
    protected void displayError(MarkupOutput out, String className, String methodName, Exception e, String title, String message,
             boolean addContactInfo) {
         
         // Create new MarkupOutput instance to use as placeholder for original rendering
         MarkupOutput tempOut = WebBeanFactory.getInstance().newMarkupOutput();
    
            // Render the original output into the temporary store, with a placeholder that'll be unique and easy to fund
         String placeholder = "FINDANDREPLACEME123";
         super.displayError(tempOut, className, methodName, e, title, placeholder, true);
         
         // get a copy of the orginal output as a string, this is where we'll find and replace
         String originalOutputString = tempOut.getCopyAsString();
         
         String replacementString = "<a href=\" http://community.Strategy.com\">community.Strategy.com</a>";
         
         // replace any matches with our replacement, if our placeholder is unique enough there should only be one
         String modifiedOutputString = originalOutputString.replaceAll(placeholder, replacementString)
    
         // Manually render this modified version of the output string
         out.append(modifiedOutputString);
     }
    
    

Additional Information

The Strategy SDK allows you to customize the standard Strategy Web interface, and extend and integrate the Strategy business intelligence functionality into other applications. However, before changing the way Strategy Web products look or behave, it is helpful to understand how the application is built. For more information regarding the Strategy Web architecture or the process of customizing Strategy Web, please refer to the MicroStrategy Developer Zone.
 
To access the Strategy Developer Zone, you must have access to the Strategy Knowledge Base, you must have purchased the Strategy SDK, and you must be current on your Strategy maintenance agreement. If you are a US-based business and believe that you satisfy all three of these conditions but you do not have access to the Strategy Developer Zone, please contact Strategy Technical Support at support@Strategy.com or at (703) 848-8700. If you are an international business, please contact Strategy Technical Support at the appropriate email address or phone number found at http://www.microstrategy.com/Support/ContactUs.asp

Customization Warning

This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy Technical Support makes no guarantee that an updated version of this particular customization will be provided. In the event of a code change in future builds, Strategy may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build. For enhancements to this customization or to incorporate similar functionality into other versions, contact your Account Executive to inquire about Strategy Consulting assistance.


Comment

0 comments

Details

Knowledge Article

Published:

October 3, 2019

Last Updated:

February 20, 2024