Comment on page
The return event allow you to exit an action early. For example if you consider the following action and event chain. The action will never execute the Create Event, since the Return Event causes the action to exit before it reaches the Create Event.
The most common use case of the Return Event is within a condition statement. To say for example, "if something happens within my action then I want to exit my action early". This is shown in the action an event chain below.
Notice that the action and event chain starts with an HTTP Request Event, then a Condition Event is used to check if a contact has been created. If the contact has not been created then we throw an error and exit the action before reaching the second Create Event.
The return event has three parameters that need to be filled out. Data, Message and Status code, as shown below.
A description of these parameters is shown below.
These parameters can be set as either variables created inside the action, within events OR passed in from an endpoint. Most commonly they will be created from within the action.
If you associate the action that contains the endpoint and run it, you can see an example of the type of information we get back in the body of the endpoint, as shown below.
As you can see the:
- Status Code populates the "Response Code" in the endpoint.
- Data parameter populates the "data" section of the Body variable.
- Message parameter populates the "message" section of the Body variable.
- Message parameter also populates the "error" section of the Body variable.