Migrate 'Validation of sub-tasks'

The Validation of sub-tasks is not yet available in JWT Cloud but can be implemented easily using a Jira expression validator.

Migration steps

Add a Jira expression validator.

Build a matching Jira expression by migrating the parameters of the Validation of sub-tasks using this template:

JavaScript
let ITI = [];
let SI = [];
let RI = [];
let FVE = (issue => issue);
let MI = 0;
let MA = 1000;
let ITA = false;
let SA = false;
let RA = false;
let FVEA = false;
 
let CON = (issue => (
    (ITI.length == 0 || ITI.includes(issue?.issueType?.name)) &&
    (SI.length == 0 || SI.includes(issue?.status?.name)) &&
    (RI.length == 0 || RI.includes(issue?.resolution?.name)) &&
    FVE(issue)
));
 
issue.subtasks.filter(CON).length >= MI
&& issue.subtasks.filter(CON).length <= MA
&& issue.subtasks.every(issue => (
    CON(issue) ||
    (ITA && !ITI.includes(issue?.issueType?.name)) ||
    (SA && !SI.includes(issue?.status?.name)) ||
    (RA && !RI.includes(issue?.resolution?.name)) ||
    (FVEA && !FVE(issue))
))

The following table shows how to obtain the individual components of the resulting Jira expression.

Migration details

Unknown AttachmentJWT DC

JWT DC option

Unknown AttachmentJWT Cloud

Notes

Filter by issue type


In line 1, add the issue type names to be filtered to the list.

Example:

Bash
let ITI = ["Submission", "Mail"];

Filter by status


In line 2, add the status names to be filtered to the list.

Example:

Bash
let SI = ["In Progress", "To Do"];

Filter by resolution


In line 3, add the resolution names to be filtered to the list.

Example:

Bash
let RI = ["Won't do", "Duplicates"];

Filter by field value


In line 4, adopt the function according to your needs by adding the respective Jira expression. It has to return a logical value. A list of field codes can be found in Field codes. For more information about Jira expression, please have a look at Atlassian's documentation.

Examples:

Bash
let FVE = (issue => issue?.attachments?.length >0 )

Bash
let FVE = (issue => issue?.project.key == 'PRJ' )

Minimum number of sub-tasks


In line 5, change the minimum number of sub-tasks if necessary (the default is set to 0)


Example:

Bash
let MI = 3

Maximum number of sub-tasks


In line 6, change the maximum number of sub-tasks if necessary (the default is set to1000)

Example:

Bash
let MA = 5

Additional options


Allow unselected issue types

In line 7, change the value to true, if you want to allow unselected issue types.

Example:

Bash
let ITA = true;

Allow unselected statuses

In line 8, change the value to true, if you want to allow unselected statuses.

Example:

Bash
let SA = true;

Allow unselected resolutions

In line 9, change the value to true, if you want to allow unselected resolutions.

Example:

Bash
let RA = true;

Allow unsatisfied field value filter

In line 10, change the value to true, if you want to allow an unsatisfied field value filter.

Example:

Bash
let FVEA = true;

Due to the different architecture, it may happen that the condition gets too complex. This is the case when many fields are checked. The condition cannot be saved, and a corresponding error message will be displayed. If that's the case, the condition has to be split up into two or more. 

Validation options

This parameter is not available in JWT Cloud. 

Error message

In JWT Cloud, only a fixed text without field codes or translations is supported.


Examples 

Unknown AttachmentJWT DC parameter values

Jira expression

Use case All sub-tasks in the Closed status must have a specific resolution

Parameter

Value

Filter by issue type

empty

Filter by status

Closed

Filter by resolution

Done

Filter by field value

empty

Minimum number of sub-tasks

leave the default value 0 unchanged

Maximum number of sub-tasks

leave the default value 1000 unchanged

Additional options

Check

Allow unselected issue types

Allow unselected statuses

let ITI = [];
let SI = ["Closed"];
let RI = ["Done"];
let FVE = (issue => issue);
let MI = 0;
let MA = 1000;
let ITA = true;
let SA = true;
let RA = false;
let FVEA = false;
...


Use case Close parent issue only when all sub-tasks are closed

Parameter

Value

Filter by issue type

empty

Filter by status

Closed, Done

Filter by resolution

empty

Filter by field value

empty

Minimum number of sub-tasks

leave the default value 0 unchanged

Maximum number of sub-tasks

leave the default value 1000 unchanged

Additional options

Check

Allow unselected issue types

Allow unselected resolutions

let ITI = [];
let SI = ["Closed","Done"];
let RI = [];
let FVE = (issue => issue);
let MI = 0;
let MA = 1000;
let ITA = true;
let SA = false;
let RA = true;
let FVEA = false;
...


Use case An issue must have at least 3 resolved Test Cases

Parameter

Value

Filter by issue type

Test case

Filter by status

empty

Filter by resolution

Done

Filter by field value

empty

Minimum number of sub-tasks

3

Maximum number of sub-tasks

leave the default value 1000 unchanged

Additional options

Check

Allow unselected issue types

Allow unselected statuses

let ITI = ["Test case"];
let SI = [];
let RI = ["Done"];
let FVE = (issue => issue);
let MI = 3;
let MA = 1000;
let ITA = true;
let SA = true;
let RA = false;
let FVEA = false;
...