Send notification to linked Issue when all Issue Links are done(close)

A_lis April 1, 2021

Hi All,

I set up a 'Task' transition for workflow and it should work like this:

 If all tasks related to the current task are closed/resolved/done then send an e-mail notification to the user assigned to the task which is related.

workflow.JPG

Conditions:

Conditions.JPG

Post function:

PostFunctions.JPG

 

And now:

Task test-1 is related to task test-2 (connection: has to be done after).
So, when I close task-1, I should receive an email notification as a user assigned to task-2.

Unfortunately, it does not work;/
Does anyone have a similar problem or maybe know the solution?

1 answer

0 votes
Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 1, 2021

Hi @A_lis 

You want the email will be sent automatically when all related tasks are done?

If yes, you  did it wrong.

What you did is a transition, that once you click on it (in the issue view) it will check if all related issues are done, and if yes, it will send email... so the email is based on your action to click the transition button, it will not happen automatically in Task 1 while Task 2 is completed.

You need a completely another way of doing this.

I suggest plugins like ScriptRunner or Automation for Jira

A_lis April 1, 2021

@Nir Haimov Thank you!!!

That's exactly what I meant.
Do you have an idea how for example, in ScriptRunner this solution could look like? or in Automation because we have this plugins.

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 2, 2021

Hi @A_lis 

I tried with Automation for Jira and found it a bit complicated (or even not possible), but with ScriptRunner it is possible, i will give you the direction and hope you will managed from there:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def issueManager = ComponentAccessor.getIssueManager()
// get all OutwardLinks links of issue
def outwardIssueLinks = issueLinkManager.getOutwardLinks(issue.getId())
// get all InwardLinks links of issue
def inwardIssueLinks = issueLinkManager.getInwardLinks(issue.getId())

// Now loop through each of the issue links above,
// For each issue in the link,
// Look again for all OutwardLinks and inwardIssueLinks
// There for each issue check the status, if all are Done, Closed, Resolved
// You can close the issue that they are all linked to

 Put this script in a listener, to run when "issue transitioned", if issue transition to one of the statuses you want: Done, Closed, Resolved... than run the script above and follow the instructions i wrote you

Suggest an answer

Log in or Sign up to answer