ExecuteCustomObject() Action

The ExecuteCustomObject action allows you to run a Custom Object that has been configured using the Custom Object wizard. The ExcecuteCustomObject action requires that the Custom Object is of type "Action".

You can use this action, for example, when you want to send a notification in response to a UserLogin or UserLogout event. The Custom Object would contain the code for sending the notification. The main steps for creating a Custom Object that you want to run using ExecuteCustomObject:

  1. Create a Custom Object of Type "Action", with a name and parameters.

  2. Create an Expression Rule that calls your Custom Object with values for the parameters.

For example, suppose the name of your Custom Object Action is "MyNotificationAction" and it takes the parameters "Subject" and "Message". In your Expression Rule, you would use ExecuteCustomObject as follows:

ExecuteCustomObject("MyNotificationAction,"AlarmRaised","TempCritical")

If an Expression Rule is generated by a Data Item, that Data Item and its value are made available automatically to a Groovy script that is executed by this action. The same is true for other triggers, such as an Alarm. These objects are made available as "global variables." For details on these global variables, refer to Global Variables for Custom Objects.

Note:  If no Boolean, Double, or Integer result is returned, then the ExecuteCustomObject action returns true by default.

For information about the context in which custom objects are run by this action, refer to Context for Running Custom Objects from Expression Rules or Web Services.

Note: In general, the custom objects of Type IDM Agent WS Extension are not relevant in the Expression Rule evaluation context. Only Request, Response, SDK Context, and Device objects are available for IDM Agent WS Extension Custom objects.

 

Format:

ExecuteCustomObject(String customObjectName, additionalParams)

where:

customObjectName - name of the Custom Object containing the Groovy script that you want to run.

additionalParams - optional, additional parameters for the Custom Object to process. These parameters can include Strings, Booleans, Numbers, and objects (namespace.symbol) from the Expression Rule trigger. For example, if the trigger for the Expression Rule is a user login, then you can use User.name as a parameter here.

Examples:

Trigger: Alarm

Then/Else: ExecuteCustomObject("SendTweet","SLadmin@company.com")

Runs the Custom Object called "SendTweet". This Custom Object takes a recipient parameter.

 

Trigger: Alarm

Then/Else: ExecuteCustomObject("AckAlert")

Runs the Custom Object called "AckAlert" without any additional parameters.

 

Trigger: Alarm

Then/Else: ExecuteCustomObject("AckAlert","Alert Auto-acknowledged.")

Runs the Custom Object called "AckAlert" with an additional parameter for the script. The parameter provides text for the Alert message.