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

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

Set Linked Issue dependencies via post-function with JMWE or Scriptrunner

Hi all,

I'm wondering if there is a way to automatically set issue links through Scriptrunner or JMWE post-function.

So far, I have four 'create/clone issue(s)' post-functions set for the Epic workflow in a project to automatically create and nest four different types of issues under the triggering epic:

Screen Shot 2021-09-14 at 5.14.35 PM.png


Each of the Issues in epic (Define Requirements, Solutions Analysis, Implementation, and Rollout) have their own set of sub-tasks which are also auto-generated via post-functions set in workflows unique to each issue type. For example, Rollout:


Screen Shot 2021-09-14 at 5.15.48 PM.png

Almost all the issues created have linked issue dependencies:

Screen Shot 2021-09-14 at 5.49.09 PM.png

This is where I'm stuck. I'm not exactly sure how to set the 'Linked Issues' field to direct to issues that aren't directly involved in the automation. For instance, I have a 'Create / Clone Issue(s) Post-function' set in the create transition for the Rollout workflow that's responsible for creating the Update Documentation Sub-task nested under Rollout:

Screen Shot 2021-09-14 at 6.32.50 PM.png

In Groovy, what expression would work to set a "blocks" link to the parent issue's epic, as well as a "is blocked by" link to a separate sub-task nested in the parent issue called Plan Communications?

1 answer

Hi @Ian Balas

Since you are using jmwe already, I would just script everything from with the groovy script post function.

Here is an example on how to link tickets:


Thanks for the reply @Fabian Lim

So I tried using that snippet for my use case to link the Update Documentation sub-task that's being created here to the most recently created Plan Communications sub-task (both of which are nested under the same Rollout parent issue) indicating that the Update Documentation sub-task "is blocked by" the Plan Communications sub-task. I added this as a post-creation script in the 'Create / Clone Issue(s)' post-function that creates the Update Documentation sub-task:

import com.atlassian.jira.component.ComponentAccessor

def issueManager = ComponentAccessor.issueManager

// the issue key to create the link from
final String sourceIssueKey = newIssue.getAsString("issuekey")

// the issue key to create the link to
final String destinationIssueKey =
.find { issue.getAsString("issuetype") == "Plan Communications" }

// the name of the issue link
final String issueLinkName = "Is Blocked By"

// the sequence of the link
final Long sequence = 1L

def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager)

def sourceIssue = issueManager.getIssueByCurrentKey(sourceIssueKey)
def destinationIssue = issueManager.getIssueByCurrentKey(destinationIssueKey)
assert sourceIssue && destinationIssue: "Source and/or Destination Issue(s) does not exist"

def availableIssueLinkTypes = issueLinkTypeManager.issueLinkTypes
def linkType = availableIssueLinkTypes.findByName(issueLinkName)
assert linkType : "Could not find link type with name $issueLinkName. Available issue link types are ${availableIssueLinkTypes*.name.join(", ")}"

ComponentAccessor.issueLinkManager.createIssueLink(,,, sequence, loggedInUser)


I seem to get an error trying to pull the issue key for the new issue created by the post-function as a whole:

groovy.lang.MissingPropertyException: No such property: newIssue for class: script_ed72a80b03323e9341f643bdd9c8b891

This I'm not sure why I'm getting this error since this issue variable should be valid to call after the issue is created. 

Hi @Ian Balas

I would recommend you use the groovy postfuntion where you would create the all the tickets and linkages.  You will then have all the keys of the issues created in one place. Using separate postfunctions to create/clone and then link issues may not be the right approach.  


Suggest an answer

Log in or Sign up to
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

Delivery and Operations Teams can be more Effective and Profitable

    Managing services end-to-end, optimizing efforts to deliver the best services to customers. This is what team leaders and managers want to achieve. When using a tool like Jira, it...

46 views 0 1
Read article

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