Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 27 Next »

Due to various reasons it can happen that a task on a system ends up without any user available to process it. This may happen because roles / groups that define assignees to a task are empty or the assignees were deleted. The first script provided here identifies these tasks and prints them out in a JSON format. With the second script it is possible to reassign these tasks based on some rules. They can be downloaded from the bottom of this page.

The scripts uses REST calls to communicate with the target system. If the target system returns an error status code, the error details will be printed on the command line.

Script 1: Identify tasks without any users

This script identifies tasks without any users and print them out in JSON.

Parameters

This script supports passing various parameters explained below.

The following four parameters are for connecting to the target system and are required to execute the script:

targetSystemIp (default: “localhost”)
IP address of the target system.

targetSystemPort (default: “8080”)
Port of the target system.

username (empty by default)
Name of the user who is authorized to perform the script's actions. In particular, this involves
the functional right MANAGE_PROCESSES.

password (empty by default)
Password of the provided user.

It is also possible to filter for specific processes with the following optional parameters:

processStates (default: [“RUNNING”])
Filter parameter to search for processes in specific states.
Parameter is a string array. Process query searches of processes which are in one of the folllowing states. If empty or null value is passed, this filter will be ignored and the query will filter for all available process states.

modelIds (not set by default)
Filter parameter to search for processes of specific models.
Parameter is a string array. Process query searches of processes which have one of the provided models. If empty, not set or null, this filter will be ignored and the query will filter for all available models.

projectId (not set by default)
Filter parameter to search for processes of a specific project. If empty, not set or null, this filter will be ignored and the query will filter for all available projects.

creatorId (not set by default)
Filter parameter to search for processes started by a specific user. If empty, not set or null, this filter will be ignored and the query will filter for all available creators.

Prerequisites

At first, the script will check if the target system identified by parameters targetSystemIp and targetSystemPort is reachable and running. After that, it will be checked if the provided credentials username and password are valid on that system and if the user has the required privilege MANAGE_PROCESSES.

If not, the script will terminate with an appropriate error message.

Example

An example call of the script with target system localhost:8080 (set by parameter’s default values):

.\SearchTasksWithoutUser_v2.ps1 -userName "roger" -password "rabbit" -modelIds "951049FDF8E14100BE7D810A2F018177", "951049FDF8E14100BE7D810A2F018177"

With this call, processes are filtered for running processes (set by default) and started by a model with one of the passed IDs.

To save the output directly in a JSON file, use the ">" operator:

.\SearchTasksWithoutUser_v2.ps1 -userName "roger" -password "rabbit" > tasks.json

Example output

[
    {
        "ActivityId":  "7C5C8AA9A6A24F71B4F17F9C3E2350EE",
        "ModelName":  "ComplexFlow",
        "ModelId":  "A7DDB1648BEF4D2B8545BB173DBC2DB1",
        "Link":  "http://localhost/app/management/index.html#/processdetails/43F7FC4D83054CBAA4553804D9EBCEAA",
        "ProcessName":  "ComplexFlow 15",
        "ProcessId":  "43F7FC4D83054CBAA4553804D9EBCEAA",
        "Reason":  "No existing performers",
        "ActivityName":  "verification"
    },
    {
        "ActivityId":  "6BEDE7FD2CE64C92A47B607B4B5F1577",
        "ModelName":  "ComplexFlow",
        "ModelId":  "A7DDB1648BEF4D2B8545BB173DBC2DB1",
        "Link":  "http://localhost/app/management/index.html#/processdetails/5D18FD2C779C4524826681411AD4B8EA",
        "ProcessName":  "ComplexFlow 16",
        "ProcessId":  "5D18FD2C779C4524826681411AD4B8EA",
        "Reason":  "No configured performers",
        "ActivityName":  "verification"
    }
]

Every JSON output element contains an attribute Reason stating the reason why this task has no performers as well as some more attributes. Currently, these are the possible reasons:

  1. No configured performers: There are no performers configured for this task because the list of configured performers is empty.

  2. No existing performers: There are pe rformers configured for this tasks but none of them exist on the system.

  3. No resolved performers (only for core-service version 10.0 or higher): The task has included and excluded performers configured, but the list of resolved users is empty. This may happen because the task has the exact same list of included and excluded performers configured.

Script 1 version history

Script Version

Date

Author

Supported core-service version

Description

Download

2.0

15th Mar 2024

A-Team

10.0 or higher

  • support for core-service version 10.0

1.4

15th Mar 2024

A-Team

up to 9.x

  • JSON ouput improved

1.3

12th Feb 2024

A-Team

  • user http session with target system will be stored and reused so that only one session will be used for the whole script execution instead of one sesson for every request

1.2

28th Nov 2023

A-Team

  • renamed parameter processState to processStates

  • If only one task can be found, it will still be printed out as a JSON array with one element. Before it was printed out as a single JSON element.

1.1

10th Nov 2023

A-Team

  • implemented check if core-service is reachable and running

  • implemented check if provided user credentials are correct and if user has privilege MANAGE_PROCESSES

1.0

24th Oct 2023

A-Team

-

Script 2: Reassign identified tasks

This second script loops through a JSON list of tasks and reassigns them based on some criterias.

Parameters

The script supports passing various parameters explained below.

The following four parameters are for connecting to the target system and are required to execute the script:

targetSystemIp (default: “localhost”)
IP address of the target system.

targetSystemPort (default: “8080”)
Port of the target system.

username (empty by default)
Name of the user who is authorized to perform the script's actions. In particular, this involves
the functional right MANAGE_PROCESSES.

password (empty by default)
Password of the provided user.

You have to provide a JSON list of tasks that can be iterated over. You have two options to do that:

  1. If you have a JSON file, you can pass the path to it with the following parameter.

inputFilePath (empty by default)
The path to the JSON file containing all your tasks.

  1. Call both scripts in a pipeline. Take a look at the Example section below for more information.

Prerequisites

At first, the script will check if the target system identified by parameters targetSystemIp and targetSystemPort is reachable and running. After that, it will be checked if the provided credentials username and password are valid on that system and if the user has the required privilege MANAGE_PROCESSES.

If not, the script will terminate with an appropriate error message.

Functions to reassign the tasks

This script provides some basic functions to reassign the tasks:

  • reassign all tasks to another user:

reassignTasks $tasks <user_id>

This function loops through all tasks and reassigns all of them to a user with the given ID.

  • reassign tasks based on a property value:

reassignTasksBasedOnProperty $tasks <property_name> <expected_value> <user_id>

This function loops through all tasks and reassigns a task to a user with the given ID if the property has the expected value. If not, this task will be skipped and not reassigned.

You can also specify a second user ID to which the task will be reassigned if the property has not the expected value:

reassignTasksBasedOnProperty $tasks <property_name> <expected_value> <user_id_if> <user_id_else>

If the task has no property with the given name, it will be skipped.

Please note that a task can only be reassigned based on a property that exists in your JSON list.

  • reassign tasks based on a variable value:

reassignTasksBasedOnVariable $tasks <variable_name> <comparison_operator> <expected_value> <user_id>

This function loops through all tasks and reassigns a task to a user with the given ID if the condition applies. If not, this task will be skipped and not reassigned.

You can pass the following comparison operators to the function: <, <=, =, >=, >

You can also specify a second user ID to which the task will be reassigned if the condition does not apply:

reassignTasksBasedOnVariable $tasks <variable_name> <comparison_operator> <expected_value> <user_id_if> <user_id_else>

If the task has no variable with the given name, it will be skipped.

Example

This script needs a list of tasks that should be reassigned. You can provide this list either ...

(1) by a JSON input file and using parameter inputFilePath:

.\ReassignTasks_v2.ps1 -userName "roger" -password "rabbit" -inputFilePath "tasks.json"

(2) by using a pipeline:

.\SearchTasksWithoutUser_v2.ps1 -userName "roger" -password "rabbit" | .\ReassignTasks_v2.ps1 -userName "roger" -password "rabbit"

By using a pipeline, you can search for tasks without any users and reassign them in one single command. The tasks found by the first script will be directly passed to the second script.

Example output

2 task(s) found to reassign.
Loop through all tasks and reassign them based on value of property: 'ModelName':
If value equals 'ComplexFlow' assign to performer with id '42636D649F14415A895752454B8E480B'
Otherwise, assign to performer with id '1EF9EB6E7F2F41D69D5408609CFF5FFD'.
If task has no property with this name, it will be skipped.
----------
1/2: Task with activity id '7C5C8AA9A6A24F71B4F17F9C3E2350EE'
-> SUCCESS: Performer with id '42636D649F14415A895752454B8E480B' added to list of included performers.
----------
2/2: Task with activity id '6BEDE7FD2CE64C92A47B607B4B5F1577'
-> SUCCESS: Performer with id '42636D649F14415A895752454B8E480B' added to list of included performers.
----------
2 task(s) reassigned.

Script 2 version history

Script Version

Date

Author

Supported core-service version

Description

Download

2.0

15th Mar 2024

A-Team

10.0 or higher

  • support for core-service version 10.0

1.0

24th Oct 2023

A-Team

up to 9.x

-

Disclaimer

Please note that these scripts are not part of the product and are not officially supported.

They use non-public REST API methods that may change without prior notice. This page will be updated in case of API changes, but the maintenance of the scripts and its derivatives in the field stays with its users.

  • No labels