Migrate 'Condition on linked issues'

The Condition on linked issues of JWT DC is not yet available in JWT Cloud, but can be implemented easily using a Jira expression condition.

Migration steps

  1. Add a Jira expression condition.

  2. Build a matching Jira expression by migrating the parameters of the Condition on linked issues using this template:

    JavaScript
    let LT = [];
    let ITI = [];
    let SI = [];
    let RI = [];
    let P=[];
    let FVE = (issueLink => issueLink);
    let MI = 0;
    let MA = 1000;
    let LTA = false;
    let ITA = false;
    let SA = false;
    let RA = false;
    let FVEA = false;
     
    let CON = (issueLink => 
      (LT.length == 0 || LT.includes(issueLink.direction == "outward" ? issueLink.type.outward : issueLink.type.inward)) &&
      (ITI.length == 0 || ITI.includes(issueLink?.linkedIssue?.issueType?.name)) &&
      (SI.length == 0 || SI.includes(issueLink?.linkedIssue?.status?.name)) &&
      (RI.length == 0 || RI.includes(issueLink?.linkedIssue?.resolution?.name)) &&
      (P.length == 0 || P.includes(issueLink?.linkedIssue?.project?.key)) &&
      FVE(issueLink)
    );
      
    issue.links.filter(CON).length >= MI
    && issue.links.filter(CON).length <= MA
    && issue.links.every(issueLink => (
      CON(issueLink) ||
      (LTA && !(LT.includes(issueLink.direction == "outward" ? issueLink.type.outward : issueLink.type.inward)) ||
      (ITA && !ITI.includes(issueLink.linkedIssue?.issueType?.name)) ||
      (SA && !SI.includes(issueLink?.linkedIssue?.status?.name)) ||
      (RA && !RI.includes(issueLink?.linkedIssue?.resolution?.name))||
      (FVEA && !FVE(issueLink))
    )))
    

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

Migration details

Unknown Attachment JWT DC

JWT DC option

Unknown Attachment JWT Cloud

Notes

Filter by link type


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

Example:

Bash
let LT = ["blocks"];

Filter by issue type


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

Example:

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

Filter by status


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

Example:

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

Filter by resolution


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

Example:

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

Filter by project




Any project

Nothing to do!


Current project

In line 5, add issue.project.key to the list

Example:

Bash
let P = [issue.project.key];

Any but current project

In line 5, add issue.project.key to the list and change line 20 to

Bash
(P.length == 0 || !P.includes(issueLink?.linkedIssue?.project?.key)) &&



Set projects manually (parser expression)

In line 5, add project keys to be filtered to the list

Example:

Bash
let P = ["CRM", "PRJ"];

Filter by field value


In line 6, 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, the fields available for an issue links can be found in IssueLink.

Examples:

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

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

Minimum number of linked issues


In line 7, change the minimum number of linked issues if necessary (the default is set to 0)


Example:

Bash
let MI = 3

Maximum number of linked issues


In line 8, change the maximum number of linked issues if necessary (the default is set to1000)

Example:

Bash
let MA = 5

Additional options


Allow unselected issue link types

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

Example:

Bash
let LTA = true;

Allow unselected issue types

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


Allow unselected statuses

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

Example:

Bash
let SA = true;

Allow unselected resolutions

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

Example:

Bash
let RA = true;

Allow unsatisfied field value filter

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

Example:

Bash
let FVEA = true;

Examples

Unknown AttachmentJWT DC parameter values

Jira expression

Use case There must be at least one related Service Management request

Parameter

Value

Filter by issue link type

empty

Filter by issue type

empty

Filter by status

empty

Filter by resolution

empty

Filter by project

Any project

Filter by field value

%{seed.issue.project.category} = 

"Service Management"

Minimum number of linked issues

1

Maximum number of linked issues

leave the default value 1000 unchanged

Additional options

Check

Allow unselected issue types

Allow unselected statuses

let LT = [];
let ITI = [];
let SI = [];
let RI = [];
let P =[];
let FVE = (issueLink => issueLink?.linkedIssue?.project?.projectCategory?.name == "Service Management" )
let MI = 1;
let MA = 1000;
let LTA = false;
let ITA = true;
let SA = true;
let RA = false;
let FVEA = false;
....



Use case Prevent transitioning when there is a blocking issue

Parameter

Value

Filter by issue link type

is blocked by

Filter by issue type

empty

Filter by status

Resolved, Closed

Filter by resolution

empty

Filter by project

CRM

Filter by field value

empty

Minimum number of linked issues

leave the default value 0 unchanged

Maximum number of linked issues

leave the default value 1000 unchanged

Additional options

Check

Allow unselected issue types

Allow unselected resolutions

let LT = ["is blocked by"];
let ITI = [];
let SI = ["Resolved","Closed"];
let RI = [];
let P =["CRM"];
let FVE = (issueLink => issueLink)
let MI = 0;
let MA = 1000;
let LTA = false;
let ITA = true;
let SA = true;
let RA = false;
let FVEA = false;
....


Use case All blocking issues must be resolved

Parameter

Value

Filter by issue link type

is blocked by

Filter by issue type

empty

Filter by status

empty

Filter by resolution

Fixed, Done

Filter by project

Any project

Filter by field value

empty

Minimum number of linked issues

leave the default value 0 unchanged

Maximum number of linked issues

leave the default value 1000 unchanged

Additional options

Check

Allow unselected link types

Allow unselected issue types

Allow unselected statuses

let LT = ["is blocked by"];
let ITI = [];
let SI = [];
let RI = ["Fixed","Done"];
let P =[""];
let FVE = (issueLink => issueLink)
let MI = 0;
let MA = 1000;
let LTA = true;
let ITA = true;
let SA = true;
let RA = false;
let FVEA = false;
....





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.