Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Scripted validator that validates that there is at least one issue linked to Epic

I'm trying to setup a 'Simple scripted validator'; when the value of a field called 'Requirements needed' (dropdown field) is set to 'Yes', there must be at least one issue linked to the Epic under 'Issues in epic'. The issue linked should be issue type 'Requirement'. If the requirements of this validation are met, the transition should proceed.

When the 'Requirements needed' field value is set to 'Yes', but there is no 'Requirement' issue linked, the transition should fail.

When the 'Requirements needed' field value is set to 'No', the transition should proceed.

I'm not very good at scripting, so I tried to put something together by using already existing scripts in our environment and Googling, but I can't get the validator to work properly.

The script I have now is:

if(cfValues['Requirements Needed']?.value == 'Yes'){
    ComponentAccessor.getIssueLinkManager().getOutwardLinks( { == "Epic-Story Link"}
}else {
    return true

This results in the issue transitioning when 'Requirements needed' is set to 'No', which is good. But in any case, with or without an issue link, the transition fails when 'Requirements needed' is set to 'Yes', which is not good.

I know the script is missing some requirements I mentioned above, but I just can't figure out how to add these requirements to the script.

I hope someone can help me with this!

1 answer

1 vote
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 09, 2022

You can access epic linkages from the IssueLinkManager. For that, you need the EpicLinkManager

Try this:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.greenhopper.manager.issuelink.EpicLinkManager
@WithPlugin("com.pyxis.greenhopper.jira") agilePlugin
@JiraAgileBean EpicLinkManager epicLinkManager

if(cfValues['Requirements Needed']?.value == 'No') return true

epicLinkManager.getIssuesInEpic(issue).any{ == 'Requirement'}

Quit early with return true is Requirements Needed is No (allows a flatter view of the script, no unnecessary indents).

Then use the epicLink manager to retrieve the issues in the epic and return either true or false if at least one of them is a Requiement.

The "@WithPlugin" line allows you to import from com.atlassian.greenhopper package.

The @JiraAgileBean is a convenience annotation provided by scriptrunner to instantiate managers and services from that package.

Hi Peter-Dave,

Thank for the help and explanations. I tried it, and it works perfectly!

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events