Hooking Entity Events for Custom Handling of Entities
- Updated on 09 May 2013
- 1 minute to read
Entity Events make it possible to run a flow upon the following events occurring to an entity:
An example of an event that could occur on the saving and/or deleting of an entity is to send a notification message to a manager when a new entity like a project quote or travel request is submitted or changed, so the manager can do a review. Another use case might be to insert an audit record into a database or directory when an entity is deleted that records details such as who deleted the entity.
In this example, a pop up message will be sent to the Managers group to let them know a new entity (a travel request) was created. The event that will trigger the email is "After Save."
Begin by navigating to the Configuration Extension folder for the entity; in this example, the folder is a TravelItinerary type. Notice the Entity Events button available.
Click onEntity Events , and select After Sa ve Flow . Name the flow "Notify Managers" and click OK .
From the Flow Designer's startup window, expand the All Steps [Catalog] > Communication category and select a Send Notification step. Click Add to place it into the workspace.
Click on the Send Notification step. From the Properties panel, click on the Add button for the Notify Group field.
Select the Travel Agent Managers group and click OK . Next, configure the message of the notification.
From the Properties panel, select the mapping type of Text Merge.Plain for the Message field.
Click the Show Editor button that appears. Notice under Entity > Data , the information about the entity is available. In the message body, we will display the entity name, description and who it was saved by. Drag and drop those variables from the list on the left into the workspace on the right. Click OK when complete.
Lastly, configure the Subject for the message, which will simply be a constant value of "Travel Itinerary Saved."
Connect the Done path of the Send Notification step to the End step.
Now, when an entity of type TravelItinerary is saved, a notification will appear.