Skip to content

Business Scenario (JSON)#

The metadata defines the actions and steps of the scenario, and the outcome of the scenario.

The metadata contains all the information about a Business Scenario, such as how it starts, how it ends, and what it does. The scenario only works properly if it follows this format.

Name Description Mandatory Type Possible Values Default Value
start Initial step to start the execution. This field is mandatory and must reference an existing step in the steps list Y String
finally Optional step to execute when no more steps are left in the start execution N
end Optional step to execute/commit the result of the scenario. It is important to use this when a resultType is defined and therefore asking the user before changing the system N String
steps List of steps available to be executed within the context of the scenarios Y BusinessScenarioStep[] []
resultType Type of result expected to result from this scenario. Used to generate some steps after the end flow
MasterData - Automatically generates the necessary steps to ask the user to load the master data
Script - Automatically generates the necessary steps to ask the user permission to execute the result script that may change the system
Custom - Doesn't generate any additional step after the end flow
N Enum Custom
MasterData
Script
Custom
description Details about the scenario and what it does N String
isVisible Whether the scenario is listed in the Cortex scenario dropdown. When false, the scenario is not listed, but other scenarios can still execute it with a CallScenario step N Boolean true
false
true

Info

*The list of steps doesn't need to be ordered. The execution follows a linked list approach * The first step to execute is the one referenced in the start property *When no more next step is defined, the engine will start executing the step referenced in the finally property * When the finally steps are finished (or no finish step is configured), the end step is executed after all pre-configured steps from the result type (if any)

Example snippet#

{
    "start": "CheckIfUserIsIntegrationUser",
    "resultType": "Script",
    "end": "DeployManagers",
    "steps": [
        {
            "name": "CheckIfUserIsIntegrationUser",
            "type": "Script",
            "resultKey": "selectedUser",
            "settings": {
                "script": [
                    "if(!this.securityService.user.IsIntegrationUser) {",
                    "   throw new Error('This scenario can only be executed by a User that is an Integration User');",
                    "}",
                    "this.securityService.user"
                ]
            },
            "next": "Mode"
        },
        {
            "name": "Mode",
            "type": "Question",
            "resultKey": "selectionMode",
            "settings": {
                "message": "Do you wish to have a manual selection with ',' separated Manager Names or the interactive mode?",
                "dataType": "Enum",
                "settings": {
                    "enumValues": [
                        "Manual",
                        "Interactive"
                    ]
                },
                "defaultValue": "Interactive"
            },
            "next": "ModeCondition"
        },
        (...)
        {
            "name": "DeployManagers",
            "type": "Script",
            "settings": {
                "script": "${script(./scripts/mass-deploy/mass_deploy.ts)}"
            },
            "next": ""
        }
        (...)
    ]
}