{
  "version": "1.8.2",
  "timeZone": "Etc/UTC",
  "title": "API examples for acces to order variables",
  "orderPreparation": {
    "parameters": {
      "color_blue": {
        "type": "String"
      },
      "color_red": {
        "type": "String"
      },
      "color_orange": {
        "type": "String"
      },
      "num_of_days": {
        "type": "Number"
      },
      "is_end_of_month": {
        "type": "Boolean"
      },
      "password": {
        "type": "String"
      }
    },
    "allowUndeclared": false
  },
  "instructions": [
    {
      "TYPE": "Execute.Named",
      "jobName": "job-python-get-arguments",
      "label": "job-python-get-arguments"
    },
    {
      "TYPE": "Execute.Named",
      "jobName": "job-python-list-arguments",
      "label": "job-python-list-arguments"
    }
  ],
  "jobs": {
    "job-python-get-arguments": {
      "agentName": "testAgent",
      "withSubagentClusterIdExpr": false,
      "executable": {
        "TYPE": "InternalExecutable",
        "internalType": "Python_Graal",
        "script": "class JS7Job(js7.Job):\n    def processOrder(self, js7Step):\n        logger = js7Step.getLogger()\n        \n        logger.info(\"[getOrderArgumentsAsNameValueMap] by name:\")\n\n        # Access order argument by name\n        # (i) Receives values passed as variables during order creation\n        color_blue = js7Step.getOrderArgumentsAsNameValueMap()[\"color_blue\"]\n        \n        logger.info(f\"argument color_blue={color_blue}\")"
      },
      "skipIfNoAdmissionForOrderDay": false,
      "killAtEndOfAdmissionPeriod": false,
      "parallelism": 1,
      "graceTimeout": 1,
      "failOnErrWritten": false,
      "warnOnErrWritten": false,
      "title": "Access specific order variables",
      "isNotRestartable": false
    },
    "job-python-list-arguments": {
      "agentName": "testAgent",
      "withSubagentClusterIdExpr": false,
      "executable": {
        "TYPE": "InternalExecutable",
        "internalType": "Python_Graal",
        "script": "class JS7Job(js7.Job):\n    def processOrder(self, js7Step):\n        logger = js7Step.getLogger()\n\n        # Get list of order variables\n        # (i) Receives values passed as variables during order creation\n        args = js7Step.getOrderArgumentsAsNameValueMap()\n\n        logger.info(\"[getOrderArgumentsAsNameValueMap]:\")\n\n        for key, arg in args.items():\n            logger.info(f\"variable: {key}={arg}\")"
      },
      "skipIfNoAdmissionForOrderDay": false,
      "killAtEndOfAdmissionPeriod": false,
      "parallelism": 1,
      "graceTimeout": 1,
      "failOnErrWritten": false,
      "warnOnErrWritten": false,
      "title": "Access all order variables",
      "isNotRestartable": false
    }
  }
}