Skip to main content
Skip table of contents

UC Workflow/Task Priority [C IG]

Overview

In order to support priorities, a few key concepts must be explained:

  1. The current priority implementation only supports Service Task and Business Rule Task executions.

  2. A default variable WorkflowInstancePriority is set as the default Task priority. The value for this variable will be passed at the start of the Workflow and will be used as the priority for all Service and Business Rule Tasks.
    Note if you want to be able to externally change the priority while a workflow is running (see Update Running Workflow With Priority), you must use this mechanism.

  3. It is also possible to set a fixed priority on the workflow level, or a specific Service/Business Rule Task.

  4. It is also possible to use a different variable to store the task priority and change its value while the workflow is running (e.g. via scripts).
    Note if you use this approach you will no longer be able to change the priority while the workflow is running.

The priority is in the range of 1-10, with the higher value meaning higher priority. The default priority is 5.

External Task Configuration in Workflow Designer

In addition, there are a few key things to keep in mind:

What is it

The priority only affects the execution of Service and Business Rule Tasks

  • If multiple of these tasks with the same name and version exists, the one with the highest priority will be processed first. Tasks with the same name, version and priority will be executed in the order they are started.

  • The highest prioritized tasks will be executed as soon as a matching task execution instance is free. It will not pause/cancel any existing running task execution in order to make way for the prioritized task.

  • Changing the priority of a running workflow only affects the next tasks to run.

    • Tasks that are already in execution are not affected and will continue to run with the same priority they have been started with.

    • The upcoming tasks in the workflow will use the updated priority.

What is it NOT

  • Workflow Started Priority

    • If a batch of Workflows are started at the same time, the workflows will start based on the sequence of the start requests. The priority has no effect in this scenario.

  • Non Service, Business Rule Task execution

    • The priority only affects Service and Business Rule Tasks. Other tasks are not affected (e.g. Call Activity, Boundary Events, etc).

Using Workflow Priority

Starting Workflow With Priority

The priority can be defined in the Workflow Payload when starting the workflow via the Workflow API Service. This is an optional value and will default to 5 if not provided.

Path Swagger Reference: Starting A New Workflow

POST  /v1/Instances/{workflowName}/{workflowVersion}

Example Payload:

CODE
{
  "Parameters": [
    {
      "Name": "IdleTime",
      "Value": "5",
      "Type": "long"
    },
    {
      "Name": "SomeStringInput",
      "Value": "Some string...",
      "Type": "string"
    }
  ],
  "Metadata": {
    "CustomField": "CustomFieldValue"
  },
  "Priority": 5
}

Update Running Workflow With Priority

There are 2 ways to update a priority within a running workflow, from the Workflow API and from the Workflow Monitor.

Path Swagger Reference: Updates an existing workflow instance's priority.

POST  /v1/Instances/{instanceId}/Priority

Special Notes:

  • Current running tasks' priorities will not be changed. This will only affects next running tasks.

  • This will only affect the tasks that use the default priority mapping (via the WorkflowInstancePriority variable). Any tasks that defined a fix priority or custom variable will not be modified with this.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.