# Global Action Events

Global Events are actions that can be attached one of a specific list of events that will occur within the Exago application. These events usually trigger in response to user input, but they are not necessarily directly related to the input action, and thus will not transfer information about the user input. However, global events are more reliable than capturing user clicks, especially in response to actions that can be taken in a variety of ways, such as saving a report.

Please note that a subset of global events, namely the ones which are used to handle report tree interaction, require a true or false return value in the client script. True indicates to Exago that we don't want to continue with the "normal" course of action, which we have replaced with our custom code. False indicates that we should continue with the normal action.

For example, when double-clicking on a third party (non-Exago) report, we may want to launch an external editor instead of the Exago report designer. We would check the report type, and if it is a third party report, we would insert our callout and then return True. If it is a regular Exago report, we would continue with the normal course of action by returning False.

Also note that for these events to be able to have a return value, they must be enclosed within a javascript function. This means that if you want to write the full client scripts in the admin console (rather than calling out to a separate function) each event will need to be wrapped in an auto-executing anonymous function, like so:

    string jsCode = @"(function()
    	{
    		/* javascript stuff; */
    		return true;
    	}())";

    sessionInfo.JavascriptAction.SetJsCode(jsCode);
    return sessionInfo.JavascriptAction;

# List of Global Events

Events which require a true/false return value are labeled.

OnSaveReport

Description | Fires when a user attempts to save an open report. This action event overrides the default save handling. If this action event is implemented, reports will not be saved by the normal means.
Remarks | Passes the report object.

OnDuplicateReport

Description | Fires when an open report is duplicated.
Remarks | Passes the report object.

OnEditReport (v2016.3+)

Description | Fires when a report is opened for editing.
Remarks | Passes the webReportsCtrl object, i.e. the application DOM, including the main UI window, folders tree, main menu, etc. Returns true or false to indicate whether to continue normal operation. Must be enclosed in a function.

OnSelectReport (v2016.3+)

Description | Fires when a report item in the folders tree is selected.
Remarks | Passes the webReportsCtrl object, i.e. the application DOM, including the main UI window, folders tree, main menu, etc. Returns true or false to indicate whether to continue normal operation. Must be enclosed in a function.

OnDeleteReport (v2016.3+)

Description | Fires when a report is deleted from within the folders tree.
Remarks | Passes the webReportsCtrl object, i.e. the application DOM, including the main UI window, folders tree, main menu, etc. Returns true or false to indicate whether to continue normal operation. Must be enclosed in a function.

OnRenameReport (v2016.3+)

Description | Fires when a report is renamed from within the folders tree.
Remarks | Passes the webReportsCtrl object, i.e. the application DOM, including the main UI window, folders tree, main menu, etc. Returns true or false to indicate whether to continue normal operation. Must be enclosed in a function.

OnExecuteReport (v2016.3+)

Description | Fires when a report is executed from within the folders tree.
Remarks | Passes the webReportsCtrl object, i.e. the application DOM, including the main UI window, folders tree, main menu, etc. Returns true or false to indicate whether to continue normal operation. Must be enclosed in a function.

OnDoubleClickReport (v2016.3+)

Description | Fires when a report item in the folders tree is double-clicked.
Remarks | Passes the webReportsCtrl object, i.e. the application DOM, including the main UI window, folders tree, main menu, etc. Returns true or false to indicate whether to continue normal operation. Must be enclosed in a function.

OnRightClickReport (v2016.3+)

Description | Fires when a report item in the folders tree is right-clicked.
Remarks | Passes the webReportsCtrl object, i.e. the application DOM, including the main UI window, folders tree, main menu, etc. Returns true or false to indicate whether to continue normal operation. Must be enclosed in a function.

OnAfterAddDataObject

Description | Fires after a data object is added to a report.

OnBeforeRemoveDataObject

Description | Fires before a data object is removed from a report.

OnChangeParameterValue

Description | Fires when the value of a parameter in a prompt is changed
Remarks | This is commonly used in conjunction with parameter drop-downs in order to selectively enable, disable, and populate fields.

OnDashboardResize

Description | Fires when a running dashboard has its container size changed, by either the web page or the browser window
Remarks | This is commonly used to enable dashboards to re-format their contents in response to changing screen size.

OnBeforeCloseApiWindow

Description | Fires when the user clicks the cancel button in an iFrame or modal window containing a report wizard.
Remarks | This can be used to provide a javascript callback to close the window automatically, rather than returning to a blank page.

OnSaveReportSuccess (v2017.1.5+)

Description | Fires after an existing report is successfully saved from a Wizard, Designer, or Viewer. Works for all report types. Also fires when an Advanced Report is created from an ExpressView, Express Report or a Dashboard Visualization. Does not fire when a report is duplicated, or when a User Report is saved as a new Advanced Report from the Report Viewer. Use OnDuplicateReport for these cases.
Remarks | This can be useful for implementing handlers to update the host application after reports are saved. This does not interfere with the default report saving behavior. Report name (path and filename) is available to the action event handler through the reportName property of the ClientInfo object.