Hi atlassian community,
we would like to send a custom notification to a customer when a specific transition was triggered. We have now several postfunctions working, the first one is a script runner post function cloning the contents of the issue to a new issuetype and linking it to the issue.
The second function should send a notificiation mail, that the issue is being moved to the issue XX-XXX. The template is working fine, but I have no idea on how to mention the newly created linked issue within the customer notification.
Has somebody solved a related issue?
Edit:
I found a function that maybe helps, but still not idea how to put that correct within the email template:
issueFunction in linkedIssuesOf("status = Open", "blocks") and resolution is empty
You don't need to use the JQL. That's a bit round-about.
You just need to use the issueLinkManager to find the linked issue.
In your "Condition and Configuration" box add the following
def linkedIssues = issueLinkManager.getLinkCollectionOverrideSecurity(issue).allIssues
if(!linkedIssues){
//this will skip the execution of the send mail post function since no linked issue were found
//it probably means something when wrong in your earlier postfunction to create the linked issue
return false
}
config.lastLinkedIssueKey = linkedIssues.last().key
//make sure the condition returns true to trigger the rest of the send mail postfunction
return true
Then, in your Email Template, you can include any parameters added to "config"
Here is the body of your email
Where you might want to include ${config.lastLinkedIssueKey}
If you don't want to just blindly return the last linked issue, you can examine the information you get from getLinkCollectionOverrideSecurity() and filter by link type. Or examine the full list of issues and filter by status or other attributes.
E.g
//only get the linked issues wihtout resolution
def filteresLinkedIssues = linkedIssues.findAll{ !it.resolution}
//only get the linked issues with status filer
def filteresLinkedIssues = linkedIssues.findAll{ it.status.name=='Open'}
//filter based on link type... you might want to look at getInwardLinks instead
def blockers = issueLinkManager.getLinkCollectionOverrideSecurity(issue).getOutwardIssues('Blockers')
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.