Script Runner Validator to check if the issue is linked with a Specific link type.

Ganesh Kumar Vary March 26, 2023

Hi all,

I have a requirement where a User Story should be moved to next transition only if it is linked to another User Story with link type Addresses.

I have used a simple one-line Script: issue.links.length >0 in the Script runner Validator which is restricting the transition when there is no linked issue. But I couldn't find a way to include the link type in the validator. please see the SS attached for more detail.

Script Validator.png

 

Can anyone suggest me a syntax so that I can include the link type also here?

 

2 answers

2 accepted

4 votes
Answer accepted
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 27, 2023

Hi @Ganesh Kumar Vary 

I would use something like:

issue.links
.map(it =>it.type.name == "Addresses")
.filter(i => i == true)
.length > 0

Keep in mind that "Addresses" should the name of the link type, not the names of the inward/outward links .

Ganesh Kumar Vary March 27, 2023

Thank you @Alex Koxaras _Relational_  this solved my problem. I Appreciate the quick response.

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 27, 2023

@Ganesh Kumar Vary kindly mark both answers as accepted then, to help others in the community with similar problems. Thank you!

0 votes
Answer accepted
Juan Carlos Vera
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2023

Hi @Ganesh Kumar Vary ,

You can try this ScriptRunner Validation:

 

issue.links != null ? issue.links.some(link => link.type.name == "Addresses") : true
Ganesh Kumar Vary March 27, 2023

Thank you @Juan Carlos Vera  this solved my problem. Bothe solutions worked fine for me. I Appreciate the quick response.

Ganesh Kumar Vary May 9, 2023

Can I check if the linked issue is a Specific issue Type here?

 

something like the linked issue type should be either Epic or Story issue type.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events