User Task Forms

User Task allows to associate a task form to be task two ways. The configured information is evaluated and populated on the task record which can be used by application to display appropriate form to end user.

Form Key

Use form-key, when form web-component for task completion is separately developed in application and a simple association is required. The evaluated form-key is populated on the created task model that can be used by application to display appropriate form. An expression can be provided in this field.

Image

When a form key is specified, the task record is created as follows:

  • formType is set as “FormKey
  • formKey is set to the value specified in task definition
  • All process variables are copied over as formVariables in the task record.
{
    "name": "Approval Task",
    "status": "pending",
    "processTokenId": "...",
    "formKey": "approval-form",
    "formType": "FormKey",
    "formVariables": {
        "fromDate": "2019-12-15",
        "toDate": "2020-01-03",
        "comments": "Vacation",
        "_workflowInstanceId": "..."
    },
    "id": "...",
    "processInstanceId": "....",
    "workflowInstanceId": "...."
}

Some data ignored for brevity.

Form Data

Form Data on the other hand allows defining various fields that would appear on user task form. This defined data merged with current process variables can be used to auto-generate task form at run time and populate the data.

Image

Notice that we populate default values on the form by taking values from process variables.

{
  ...
  "formType": "FormData",
  "formVariables": {
    "fromDate": {
      "id": "fromDate",
      "label": "From Date",
      "type": "date",
      "defaultValue": "2019-12-15",
      "validations": [
        {
          "name": "readonly",
          "config": "true"
        }
      ],
      "properties": []
    },
    "toDate": {
      "id": "toDate",
      "label": "To Date",
      "type": "date",
      "defaultValue": "2020-01-03",
      "validations": [
        {
          "name": "readonly",
          "config": "true"
        }
      ],
      "properties": []
    },
    "comments": {
      "id": "comments",
      "label": "User Comments",
      "type": "string",
      "defaultValue": "Vacation",
      "validations": [
        {
          "name": "readonly",
          "config": "true"
        }
      ],
      "properties": []
    },
    "approvalComments": {
      "id": "approvalComments",
      "label": "Approval Comments",
      "type": "string",
      "defaultValue": "OK",
      "validations": [],
      "properties": []
    }
  },
  ...
}