Property description

The workflows property is a set of workflow states that an object goes through during its lifecycle in Dawiso.

Tip

Before creating a workflow, make sure you already defined your workflow states.

Minimal JSON

{
  "key": "",
  "name": "",
  "initStateKey": ""
}
{
  "key": "basic_workflow",
  "name": "Basic workflow",
  "description": "",
  "state": "active",
  "isDefault": false,
  "isEmpty": false,
  "initStateKey": "draft",
  "diagramContentType": "image/png",
  "diagramContent": "iVBORw0KGgoAAAANSUhEUgAACGAAAARmCAIAAAD...",
  "transitions": [
    {
      "name": "Draft",
      "fromStateKey": "approved",
      "toStateKey": "draft",
      "changeThresholdTypeKey": "one_user",
      "userRelationTypes": [
        {
          "key": "core#steward"
        }
      ]
    }
  ]
}

Example taken from the core package.

Ownership

A workflow can be defined in one package only. When a package defines a workflow that another package already owns, the install fails with an error naming the owning package (“Workflow '' is defined in package ''. Defining it in package '' is forbidden; reference it instead.”). To use such a workflow, reference it instead of defining it.

Nested properties

PropertyDescriptionValuesMandatory
keyUnique key of the asset. Used for referencing in the same package or other packages using packageKey#assetKey.stringYes
nameName of the asset, used as the default EN translation.stringYes
initStateKeyKey of the workflow’s initial workflow state.stringYes
descriptionDescription of the property, displayed as a tooltip.stringNo
diagramContentTypeWorkflow diagram image type, in MIME format. Supported values: image/png, image/jpeg, image/svg+xml.stringNo
diagramContentWorkflow diagram in Base64 format.stringNo
isDefaultDetermines whether the workflow is always selected by default.booleanNo
isEmptyDetermines whether the workflow doesn’t have any workflow states.booleanNo
isSelectableDetermines whether the workflow can be selected by other users.booleanNo
transitionsArray of transitions between workflow states.arrayNo
layoutPositions of the workflow’s states and transitions in the workflow diagram. See Layout.objectNo
stateCurrent status of the asset. Supported options are: active (asset is active and visible in the environment), inactive (asset is inactive and hidden, serves as a soft delete), hidden (asset is active but hidden in the environment).stringNo
translationsArray of translation keys and their definitions that determine how the text is displayed in the UI for the specific asset. For more information, see Translations.arrayNo

Layout

The optional layout property stores where each state and transition is drawn in the workflow diagram. The in-app workflow editor writes it when an administrator saves a workflow; you can also set it in a package. Without a layout, the diagram is arranged automatically.

{
  "layout": {
    "nodes": [
      { "stateKey": "draft", "x": 0, "y": 0 },
      { "stateKey": "approved", "x": 220, "y": 0 }
    ],
    "start": { "x": -120, "y": 0 },
    "edges": [
      {
        "fromStateKey": "draft",
        "toStateKey": "approved",
        "vertices": [{ "x": 110, "y": -60 }]
      }
    ]
  }
}
PropertyDescriptionValuesMandatory
nodesPosition of each state.arrayYes
nodes[].stateKeyKey of the workflow state.stringYes
nodes[].x, nodes[].yPosition of the state in the diagram.numberYes
startPosition of the start marker. Contains x and y.objectNo
edgesDrawing of each transition, identified by its source and target state.arrayNo
edges[].fromStateKey, edges[].toStateKeyKeys of the states the transition connects.stringYes
edges[].labelX, edges[].labelYOffset of the transition label.numberNo
edges[].verticesBends of the transition line, as an array of { "x", "y" } points in absolute diagram coordinates. Omitted when the transition has no bends.arrayNo

Every state key in layout must be the workflow’s initStateKey or a state used by one of its transitions. Otherwise validation fails with “references state [] which is not a state of the workflow”.

When you patch a package, vertices is replaced as a whole collection, not merged point by point.