Passing Event Rule variables to Action arguments

This blog shows how to configure passing a variable from an event rule to an event action. The example shown passed a variable to the Run Command action, but the same approach can be used to pass it to any event action that accepts arguments.

You can check which actions accept arguments by checking the fields available in the drop down list in the Action properties screen “Select a property to add”.

Define the event action argument

In this example we will pass the name of the name of the workstation that caused the event to trigger from the event rule input to a Run-command action, specifying the workstation name as a keyword parameter to the script “wk=workstation_name”.

From the Create Evet Rules screen, create a new event and add the event rule to be triggered. For our purposes any event triggering rule will work.

Now add an Event Action using the Action section of the screen – in our example we are using the “Run Command” action, but any action that accepts arguments will work. Click the Run Command Action and scroll down to the Properties section.

Referencing the screenshot below

  1. Click the “Select a property to add” button and choose the “First argument” field
  2. Enter the full path to the script or command to be executed – by default this will be executed on the same system where the Event Processor is running
  3. Enter the value for the argument to be passed to the script – in our example this is “wk=” to indicate the keywork parameter to be passed
  4. Click the “Variable” button and choose the variable containing the value to be passed to the script. In our example, this is the variable named “Workstation”. The variable will be added to the end of the current field and enclosed in %{} to indicate it is a variable to be substituted

Make sure the event rule is not in DRAFT status before saving and testing the event rule action. If the event rule doesn’t work as expected, check the SystemOut.log file in the WebSphere directory for additional information to help debug the problem.

The above process has been tested on TWS 8.6 and higher.

Visits: 75

Author:

Ina Costin

Lorem Ipsum is simply dummy text of the printing and typesetting industry.