Skip to main content
EventData gives you access to contextual information in an event handler. For example, the name of a created company or the amount of a sale. You can also check EventData properties after the event handler has run, to for example display a message or prevent an entity from being saved.

Example

Check if a sale has a high enough value. Return a message and block the sale for values < 100. Set for the event “Before save sale”.

Fetch variables used in the current context

EventData doesn’t work with manually run scripts!

Type

The types of events that can occur pertain to either [Service screen events][1] (beforeSetFromCgi, afterSetFromCgi, beforePrint) or triggers.
  • Integer getType()

Input values

Input values are for getting available data - a read operation. You can either fetch a specific value or a Map with all values.

Output values

Output values are for setting (or changing) data - a write operation. They are frequently set on a before save trigger to get better data quality.

Custom values

In addition to the built-in input and output values, you can also set and get custom values. These are also called state values and work just like setting and getting the standard values. The only difference is that naming the custom variables is up to you. After you set a custom value, it can be accessed - also by other EventData objects in the same script.
From version 10.5.2, we support listening for a command in StateValue to close Ticket tabs from CRMScript triggers in the Sales client.
This can be done by adding a StateValue command:ticket.tab.close.

Open dialog to handle user interaction

From version 10.1.9 we support generating a dialog from CRMScript triggers in Sales client.
In certain scenarios, it can be necessary to ask the user for input or confirmation before completing process, using this method we allow for creating a simple dialog which will return input back to CRMScript trigger. Use this to construct a useful workflow.

Messages

Validation and blocking actions

Setting criteria with a Map instead of multiple OR conditions in an if statement

Navigation uses [SOProtocol][2] and [URL parameters][3].