Table of Contents

Article

How to extend the Developer portal menus

Summary

You can add menu items to the Tools menu of the Developer portal. The options visible to each user of these portals depend on their RuleSet list and the result of any <pega:when > tags or other conditional processing.

When selected, an add-on menu item can display a list view report, run an activity, or perform other processing.

Suggested Approach

Example

In this example, four add-on-menu items appear in the Tools > Add-Ons menu.

Menu

These menu options have the following results:

  • When a user selects the Google Me add-on, a query is sent to that external Web site.
  • The Operators by Group add-on executes a list view rule, presenting results in a new window.
  • The Activity add-on calls an activity, presenting results in a new window.
  • The Work add-on opens a (fixed) work object in the portal workspace.

Procedure

This development task requires familiarity with XML, Process Commander JavaServer Page tags and JavaScript.

  1. Determine which RuleSet is to contain the XML rule or rules that define add-on menu items. Choose a RuleSet that is or will be available to the appropriate developer community. 
  2. Identify or build and test the activities, reports, HTML rules that are to execute when a developer selects each option. 
  3. Review the DesktopWrapperAPI, a collection of supported JavaScript functions, to identify those functions that may be useful. To learn about the functions in this standard text file rule, select Help > APIs > Desktop > DesktopWrapperAPI. These functions are often useful:

    • OpenurlInWindow()
    • ShowListInWindow()
    • ShowSummaryInWindow()

    You can also review the code in the standard XML rules named @baseclass.zzzz.MenuItem, which work similarly to menu add-ons.
  4. Create an XML rule in the desired RuleSet and Version (Application > New > Rule > Technical > XML ). Set the Applies To key part to @baseclass, the second key part to an identifier of your choosing, and the final key part to the special name MenuAddon
  5. Complete the XML tab. Carefully enter one or more entries in the following format:
    <Item Value="aaaa", Caption="bbbb", onClick="ccccc" /> 
    where Caption is the menu text and the onClick target identifies the JavaScript to execute when a user selects the menu item. You can use <pega:when...>, <pega:reference...> and other JavaServer Page tags in the XML code. 
  6. Optionally, include a <separator /> element to group items at runtime with a horizontal rule.
  7. Save the XML rule form. Confirm that your own RuleSet list contains the RuleSet version containing the XML rule (View > My Profile). Log out, as your changes take effect only the next time you log in. 
  8. Log in. Test.

Example source

XML ruleThis rule contains the following code:

<Item
  Value="Google"
  Caption="Google Me"
  onClick="openUrlInWindow('http://www.google.com/search?q=<pega:reference    name="pxRequestor.pxUserName"/>'
   ,'Hello World',
   'height=600,width=750,status=yes,toolbar=no,
    resizable=yes,menubar=no,location=no',
   true);"
/>
<Item
  Value="Report"
  Caption="Operators by Group"
  onClick="showListInWindow('Data-Admin-Operator-ID',
  'OperatorList',null,'Refresh');"
/>
<Item
   Value="Call Activity"
   Caption="Activity"
   onClick="openUrlInWindow('pyActivity=@baseclass.HelloWorld',
   'Hello',
   'height=600,width=750,status=yes,toolbar=no,resizable=yes,menubar=no,
    location=no', true);"
/>
<Item
    Value="Show Work Object"
    Caption="Work"
    onClick="openWorkItem('W-6','Perform');"
/>
<Separator />

Tags:

Published October 24, 2007 — Updated October 7, 2014

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.