--- alias: user-guide-automation-business-scenarios-building-execution-engine tags: - automation - connect iot description: "The execution engine manages scenario steps, user interaction, and result storage for automated processes" --- # Execution Engine The execution engine is responsible to execute the steps defined in the Business Scenario until the end of the execution. During the execution, some interaction with the user may happen and when it occurs, it follows the format defined in the [[user-guide-automation-business-scenarios-building-structure]]. The principles behind the execution are as follows: 1. The `start` step is executed. When it finishes the execution, it will move to the `next` step 2. Some steps require some user interaction, therefore they will only move to the `next` step when a proper answer is provided 3. The result of the execution of the step (either by come calculation or user answer) will be stored in a list of answers using the property `resultKey` as unique identification 1. It is the responsibility of the builder of the scenario to make sure the keys are unique within the entire set of steps 4. `Condition` steps allow the evaluation of previous answers to determine which step to move next. 5. `Foreach` loop allows to iterate a full list of items, one at the time, executing an alternative set of steps 1. The results will be placed in an array on the answers identified by the `resultKey` 6. `CallScenario` steps will load, prepare and execute a sub-scenario. The collection of answers and results of the entire sub-scenario will be stored in answers of the caller scenario under the `resultKey` property, allowing the access of the answers and therefore reusing scenarios. 1. Sub-scenarios can call other other sub-scenarios 2. There is no forever-loop verification in place, because there could be proper exit conditions properly implemented 7. When no next step to continue, the execution engine will execute the `finally` step (if any) following the exact same rules as defined for the `start` step. 8. When no next step is defined in the `finally` execution, the engine will evaluate the `resultType` option and elaborate a set of pre-defined steps that will, i.e., inform the user that all the required information was already collected and ask for a confirmation to continue. If the `resultType` is set to `custom` the scenario builder can create his own end action. 9. When everything is handled, the engine will execute the `end` step where it is expected to return the result of the scenario in either a Master Data format or by executing a script that will make the necessary changes in the system.