Hooking Entity Events for Custom Handling of Entities
  • 28 Jun 2021
  • 2 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Hooking Entity Events for Custom Handling of Entities

  • Dark
    Light

Article summary

Overview

Entity Events make it possible to run a Flow when certain events occur 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.

This type of Flow will run every time an Entity of this type is saved. Please take care to not use any save or assigned steps that could cause this Entity to be saved in a cycle. 

Example

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 pop up is "After Save."

This example uses an example that was previously configured in the Extending Entities by Adding Group Actions article. The example is available to download below.

  1. Begin by navigating to the Configuration Folder for the Entity. In this example, the Folder is a TravelItinerary type. 
  2. Notice the ENTITY EVENTS button available in the bottom action panel. 
  3. Select ENTITY EVENTS and then select After Save Flow.

  4. In the Create Entity After Save Flow dialog name the Flow "Notify Managers" and select CREATE.

    2019-07-25_1311.png

  5. In the Flow Designer, select the Done outcome path from the Start step. 
  6. In the Add After dialog, expand the All Steps [Catalog] > Communication category and choose the Send Notification step. 
  7. Select ADD to place it into the workspace.

  8. With the Send Notification step selected, navigate to the Properties panel. 
  9. Under Notify To > Notify Group select the Add New button. 
  10. In the Pick Entity dialog, select the Travel Agent Managers group and select Pick.

  11. Next, configure the message of the notification. In the Properties panel under Inputs, select Merge HTML Text for the Message mapping type. 
  12. Select the Show Editor button that appears. 
  13. Notice under Entity > Data, the information about the Entity is available. In the message body, display Entity.Traveler and Entity.Destination. 
  14. Drag and drop those variables from the list on the left into the workspace on the right.  Select Save.
  15. Lastly, configure the Subject for the message, which will be a constant value of "Itinerary Created." Connect the Done path of the Send Notification step to the End step.

Debug

Now, when an Entity of type TravelItinerary is saved, a notification will appear.


Was this article helpful?