Automation Action: Return
End execution of the Automation and return a value.
Ends execution of the Automation and returns a value. If this is the parent Automation for the incoming message then the returned value will be saved with the current message in the Message Store - otherwise the value will be passed back to the calling Automation.
Automations do not have to return a value. If all actions complete for an Automation then it will return automatically with a blank return value.
You can have multiple Return actions in an Automation inside If..Else..End If or Select Case blocks allowing you to return different values depending on conditions.
The return value can be fixed text or %variable% replacements or a combination. For example, the return value can be set to: 'New Order: %OrderNumber% For Customer %CustomerName%'.
Returned values are stored against the processed message in the Message Store. You can view the Message Store to see returned values for each message. The return value will also be displayed if you use the Send Message option in the Studio to manually send a message to an Automation.
Showing Return Values On Web Form Message Sources
If you use the Web Form message source then the return value can also be displayed to the web user after the form is submitted. Enable the Wait For & Include Automation Return Value In The Confirmation Message option on the Message Source Web Form properties.
If the return value contains HTML (eg: 'Your order number is: <strong>%OrderNumber%</strong>') it will be formatted when shown to the user. If the return value is Markdown then the markdown will be converted to HTML (eg: 'Your order number is: **%OrderNumber%**').
You can also include a redirect in the return value if you want another Web Form or URL shown after the form is submitted. See the Create Web Form Redirect action.
Returning The Return Value On API Message Sources
If you use the API message source then the return value can be returned to the calling HTTP GET or POST request. If the
&results=true querystring parameter is added to the API request then request will wait for the Automation to complete and the Automation Return value will be returned. Depending on the content of the Automation Return value, the result content-type will be served as plain text (text/plain), HTML (text/html) or Json (application/json). If the Return Value contains Markdown text it will be converted to HTML first. If the Return Value is already HTML it will be returned as HTML. If the Return Value is Json it will be returned as Json.
Providing A Link To The Automation Results
The %Msg_ResultsUrl% variable returns a static link to the Automation return value that a user can access via a web browser. Your Automation could include this variable in an outgoing email. A user can click the link to view the Automation return value at a later date. The %Msg_ResultsUrl% URL is unique for each processed message and contains a secure hash. The link will work for as long as the Message is stored in the Message Store.