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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

ScriptRunner Script or Behaviour to Limit Linked Issues to Certain Issue Types

Good Afternoon!

Let me outline what it is I'm trying to get to. 

Background Information: We have Epics, Features, and Enablers in Project B. Before any of these issueTypes can be progressed beyond a "New" status, they have to be a "Child of" issueLink to something (they're supposed to be a "Child of" an Initiative issueType, but people will put anything there to move their issue).

Ask: I want it to be that an Epic/Feature/Enabler cannot progress beyond New UNTIL it's a "Child of" an Initiative issueType (in Project A). 

I am not the best coder, just being honest. But I cannot, for the life of me, figure out how to do this via a ScriptRunner validation/script or Behaviour. 

Can someone help! Please and thank you! 

1 answer

0 votes
Derek Fields Community Leader Mar 22, 2021

Here is a start. You would install this as a Script Condition using ScriptRunner.

import com.atlassian.jira.component.ComponentAccessor;

final String LINK_TYPE = "DUPLICATE";
final String ISSUE_TYPE = "Initiative";

def linkManager = ComponentAccessor.getIssueLinkManager();
def links = ComponentAccessor.getIssueLinkManager()
.getLinkCollectionOverrideSecurity(issue)
.getOutwardIssues(LINK_TYPE)
.find{
it.getIssueType().getName() == ISSUE_TYPE
};

You need to update the Link Type and the Issue Type to match what you want. This particular code does not check that the outward linked issue is in a specific project. You can add that in the find closure if you want.

I hope that this helps.

I'm going to try this. For now, I've created two additional customFields (issuePicker with a JQL). But, this has the potential to be much cleaner.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you