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

KB204804: How to set the Send Option to “Link to history list in email” as the default selection and remove other options when creating Email Subscriptions from Report Page after execution using MicroStrategy Web SDK 9.4.1.


Community Admin

• Strategy


Web SDK example scenario demonstrating how to change the default send option, removing all other possible send now options.

There are two parts to this customization.
Part 1: Setting the Send Option to "Link to history list in email" as the default selection
 
Before Customization:
By default, the “Data in email” is selected as the default selection for the “Send:” value:

ka04W000000OdW1QAK_0EM440000002GTO.jpeg

 
After Customization:

ka04W000000OdW1QAK_0EM440000002GTK.jpeg

 

  1. Launch the Web Customization Editor.
  2. Create a new plug-in and give it a meaningful name. (For step by step instructions on creating a new plug-in, please navigate toHome > Web SDK > Customizing Strategy Web > Web Customization Editor > Features and Customizable)
  3. Click in Strategy Web Configurationinside the Application Settings view to expand the hierarchical tree. The expanded list comprises the different settings that can be modified to perform customizations.
  4. Navigate to Strategy Web Configuration > Pages
  5. Right click on report(Report Execution) > Create New Add-on
  6. Click ..next to the Source folder text field to select the src folder (under the Strategy Project) and click OK.
  7. Enter the following information for the rest of the text fields:
  8. Package: ##Any package the developer wants to use##
    Name: ##Any name for the class##
    Add-on Description: This addon will set the "Link to history list in email" as the default option.
  9. Check the checkbox for Add custom logic after fetcing data from Intelligence Server (postCollectData)
  10. Click Next.
  11. Click Finish. The java class will open in the editor.
  12. Modify the postCollectData method to include the following code:


public void postCollectData(PageComponent page) {
              // Retrieve the Subscription Editor Bean associated with the Send Now option
              SubscriptionEditorBean seb = (SubscriptionEditorBean) page.getRoot().searchChild("ncSubs");
 
 
out.println("addon email subs called");
              // If there is no SubscriptionEditorBean, then no need to perform logic
              if (seb==null){
                     return;
              }else {
                     // Determine if the Send Now dialog box is open
                     if (seb.isOpen()){
                           WebSubscription ws;
                           SubscriptionBean sb = null;
                           // Retrieve the Subscription Bean
                           sb = (SubscriptionBean) page.getRoot().searchChild("ncSubs_sb");
                           try {
                                  // Extract the Web Subscription to modify the default drop down properties
                                  ws = sb.getSubscription();
                                  WebSubscriptionDeliveryModeEmailProperties prop = (WebSubscriptionDeliveryModeEmailProperties) ws.getDeliveryMode();
setIncludeLink(true);
setSendToInbox(true);
setIncludeData(false);
                           } catch (WebBeanException e) {
                                  // TODO Auto-generated catch block
printStackTrace();
                           }
                     }
              }
       }

 

  1. Save the changes.
  2. Navigate to Strategy Web Configuration > Pages
  3. Double-click on report(Report Execution), the Properties Page Editor will open.
  4. Click on the Add-on Properties tab at the bottom of the editor, ensure that the custom add-on has been added to the add-ons list:
  5. Restart Web Server to take advantage of the new changes

 
NOTE: To apply this to the Documents (in Interactive, Editable, or Flash View Mode), the following additional steps will be taken:

  1. Navigate to Strategy Web Configuration > Pages
  2. Right click on rwd(Report Writing Documents) > Add existing Add-On
  3. Click the modify button and search for your Add-on in the text field. A matching item should appear, select it and click OK.
  4. Click Next, Click Finish.
  5. Now the Add-on should appear in the list of Add-ons for the rwd(Report Writing Documents)
  6. Save all changes and restart the Web Server to take advantage of the new changes.

 
 
Part 2: Removing other Send Options in the Drop Down
Before Customization:

ka04W000000OdW1QAK_0EM440000002GT7.jpeg

 
After Customization:

ka04W000000OdW1QAK_0EM440000002GTI.jpeg

 

  1. Launch the Web Customization Editor.
  2. Developers can use the same plugin created in Part I of this customization.
  3. Click in Strategy Web Configurationinside the Application Settings view to expand the hierarchical tree. The expanded list comprises the different settings that can be modified to perform customizations.
  4. Right-mouse click Styles and select Create Transform to launch the Transform Creation Wizard.
  5. Click .. next to the Source folder text field to select the src folder (under the Strategy Project) and click OK.
  6. Enter the following information for the rest of the text fields:

Package: ##Any package the client wants to use##
Name: ##Any name for the class##
Transform description: This transform will remove options from the Email Subscription dropdown after report execution.
Superclass: com.Strategy.web.app.transforms.SubscriptionsEditorNCTransform
 

  1. Click Next.
  2. Click the check box button for renderSusbcriptionDialog(MarkupOutput out) and click Next. 
    Click Finish. Your custom class opens in the editor.
  3. Add the following code to the renderSusbcriptionDialog method:


public void renderSusbcriptionDialog(com.Strategy.web.beans.MarkupOutput out) {
	System.out.println("renderSubscriptionDialog called");
	// Creating a Markupout object
	MarkupOutput newOutput = WebBeanFactory.getInstance().newMarkupOutput();

	/** Rendering the out of the box markup for this Schedule Pane
	 * as the remaining code will be editing the MarkupOutput object
	 * and not recreating the object. The markup will be placed in a 
	 * method Markup object so the user will not see the original Schedule Pane
	 */
	super.renderSusbcriptionDialog(newOutput);

	/** The following code was meant for version 9.4.1
	 * If for future versions, this code no longer works, uncomment the line below,
	 * this will output the Markupoutput to the console to see what "options" are created
	 * for the "Send:" drop down values. Copy and paste the new option valudes in string replace
	 * statements below.
	 */
	//System.out.println("Original Output = " + newOutput.getCopyAsString());
	// Creating a String version of the markup in order to manipulate the object
	String newOutputString = newOutput.getCopyAsString();
	// Removing the Data in Email option
	newOutputString = newOutputString.replace("<option value=\"0,0,1\">Data in email</option>", "");
	// Removing the Data in email and to history list
	newOutputString = newOutputString.replace("<option value=\"0,1,1\">Data in email and to history list</option>", "");
	// Removing the Data and link to history list in email
	newOutputString = newOutputString.replace("<option value=\"1,1,1\">Data and link to history list in email</option>", "");
	// Rendering the new MarkupOutput object to be displayed to the end user
	out.append(newOutputString);
}

 


 

 
 

  1. Save the changes.
  2. Navigate to Strategy Web Configuration > Styles
  3. Double click on SubscriptionsNarrowCastEmailStyle.
  4. Click the "Change" button for Transform: SubscriptionsEditorNCTransform. Change it to the new transform created in Step 6.
  5. Save the changes.
  6. Restart the Web Server to apply the changes.

The example provided in this document is provided “as-is” and user has read the following customization warning:
ADDITIONAL INFORMATION:
The Strategy SDK allows you to customize several Strategy products and extend and integrate the Strategy business intelligence functionality into other applications. However, before changing the way Strategy products look or behave, it is helpful to understand how the application is built. For more information regarding the Strategy products or the process of customizing Strategy products, please refer to Strategy Developer Zone (https://developer.microstrategy.com).
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@microstrategy.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 https://www.microstrategy.com/us/services/support/contact.
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:

April 13, 2017

Last Updated:

April 13, 2017