Skip to main content

Defining the Behavior of the Actions

Defining the Behavior of the Actions

To define the behavior of the actions, override the %OnDashboardAction() callback method of your KPI class. This method has the following signature:

classmethod %OnDashboardAction(pAction As %String, pContext As %ZEN.proxyObject) as %Status

The system executes this callback when a user invokes an action on a dashboard. pAction is the logical name of the action. pContext is an object that contains information about the currently selected scorecard row and that provides a way for the method to return commands to the dashboard; the next sections give the details.

A simple example is as follows:

ClassMethod %OnDashboardAction(pAction As %String, pContext As %ZEN.proxyObject) As %Status
{
 Set sc = $$$OK
 Try {
      If (pAction = "Action 1") {
              //this part defines Action 1
              //perform server-side actions
          }
         Elseif (pAction="Action 2")
         {
                //this part defines Action 2
                //perform other server-side actions
                 }
        }
        Catch(ex) {
                Set sc = ex.AsStatus()
        }
 Quit sc
}

This method defines two actions, Action 1 and Action 2.

Note:

Because %OnDashboardAction() is a class method, you do not have access to %seriesNames or other properties of the KPI class from within this method (no class instance is available from the method).

FeedbackOpens in a new tab