Start another flow

It is possible to chain flows to one another by using the "Start another flow" logic.

Only flows belonging to the same workspace can be chained.

When starting another flow, the other flow must be deployed to the same environment, as the current execution is being run at.

For example, if the current execution is running in production environment, and it is scheduled to start another flow with the ref ABCD, the other flow ABCD must also be deployed to production, otherwise this state will fail.

‚Äč

Sending outputs from current execution

The current execution's outputs can be forwarded to the next one. If this option is selected in the configuration window, the next flow will receive a flat JSON object of outputs in its entryPayload under the perviousOutputs field.

For example, say the current flow has states root and api. Let's say that the state api makes an API call to http://example.com

The next flow state_mach_2 will receive an entryPayload like this:

{
"previousOutputs": {
"root": {
"deleted": false,
"_id": "5fb182399a512a37d6edd9f1",
"state": "finished",
"payload": {
"payload": {
"originalEntryPayload": "1234"
},
"delay": 0,
"success": true,
"continue": true
},
"stateName": "root",
"createdAt": "2020-11-15T19:32:09.252Z",
"updatedAt": "2020-11-15T19:32:09.390Z",
"__v": 0,
"id": "5fb182399a512a37d6edd9f1"
},
"api": {
"deleted": false,
"_id": "5fb182399a512a37d6edd9f9",
"state": "finished",
"payload": {
"continue": true,
"success": true,
"payload": {
"status": 200,
"headers": {
"content-encoding": "gzip",
"accept-ranges": "bytes",
"age": "527370",
"cache-control": "max-age=604800",
"content-type": "text/html; charset=UTF-8",
"date": "Sun, 15 Nov 2020 19:32:09 GMT",
"etag": "\"3147526947\"",
"expires": "Sun, 22 Nov 2020 19:32:09 GMT",
"last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
"server": "ECS (nyb/1D0F)",
"vary": "Accept-Encoding",
"x-cache": "HIT",
"content-length": "648",
"connection": "close"
},
"body": "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color: #f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n \n }\n div {\n width: 600px;\n margin: 5em auto;\n padding: 2em;\n background-color: #fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n text-decoration: none;\n }\n @media (max-width: 700px) {\n div {\n margin: 0 auto;\n width: auto;\n }\n }\n </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n <p>This domain is for use in illustrative examples in documents. You may use this\n domain in literature without prior coordination or asking for permission.</p>\n <p><a href=\"https://www.iana.org/domains/example\">More information...</a></p>\n</div>\n</body>\n</html>\n"
},
"delay": 0
},
"stateName": "api",
"createdAt": "2020-11-15T19:32:09.450Z",
"updatedAt": "2020-11-15T19:32:09.684Z",
"__v": 0,
"id": "5fb182399a512a37d6edd9f9"
},
"start_a_noth": {
"deleted": false,
"_id": "5fb182399a512a37d6edda00",
"state": "started",
"payload": null,
"stateName": "start_a_noth",
"createdAt": "2020-11-15T19:32:09.730Z",
"updatedAt": "2020-11-15T19:32:09.730Z",
"__v": 0,
"id": "5fb182399a512a37d6edda00"
}
},
"originalEntryPayload": "1234"
}

As you can see in the following object, the other flow state_mach_2 received a flat object of outputs from the current flow's execution and the entryPayload of the previous flow (under originalEntryPayload field, this will only be sent if the option Forward Entry Payload is toggled).

Forwarding entryPayload

If you toggle Forward Entry Payload in the state's configuration window, the entryPayload of the current execution will be forwarded to the next one.

You can also specify a static entryPayload JSON for the next flow to receive as entryPayload. (Using the JSON editor in the same configuration window).