Skip to content

Updating a Workflow

Changes on a planning model might require an update of the workflow. During a running workflow no model upload, model update and no structure update are possible. So in this case the workflow status has to be updated.

Warning

There are some restrictions when changing the 'status' of the workflow:

Only the following transitions are allowed:

current workflow status new workflow status
NOT_STARTED RUNNING
RUNNING PAUSED
PAUSED RUNNING
RUNNING FINISHED
FINISHED NOT_STARTED
FINISHED EXPORTED
EXPORTED NOT_STARTED

The change of the workflow status to 'RUNNING' is only allowed when

  • the workflow has a title
  • a planning model is present
  • at least one editor is present
  • at least one form exists in the application

Also it is possible to change the title or the end date of the workflow.

The update of a workflow instance can be performed with a PATCH-request:

curl -s -i -X PATCH \
  -H "Authorization:Bearer ${TOKEN}" \
  -H "Content-Type:application/json-patch+json" \
  -d JSON_PATCH \
  "${WORKFLOW_INSTANCE_URL}"

JSON_PATCH is a place holder for the following use cases:

  • changing the title:

    [
      {
        "op": "replace",
        "path": "/title",
        "value": "new Title"
      }
    ]
    

  • changing the end date:

    [
      {
        "op": "replace",
        "path": "/endDate",
        "value": "new end date"
      }
    ]
    

  • changing the workflow status:

    [
      {
        "op": "replace",
        "path": "/status",
        "value": "updated status"
      }
    ]
    
    To pause a workflow you have to set the status of a running workflow to "PAUSED". To resume then to a running workflow you have to set the status to "RUNNING".

  • You can update more than one field within one request:

    [
      {
        "op": "replace",
        "path": "/title",
        "value": "new Title"
      },
      {
        "op": "replace",
        "path": "/status",
        "value": "updated status"
      }
    ]