You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi @All here !!
Recently, I tasked to send an e-mail notification to an address when issue with component 'A' is open.
This is easy to do in the workflow post function, but it is necessary for several projects, and each project use several workflows. So, one solution is to change a dozen workflows or use listeners.
My example with the listener.
The first step is to create a listener 'Send a custom email'. By this we can set our projects scope. I set the event 'All issue events' and provided condition what issues are being taken for us.
def result = false
//log.info(event.getEventTypeId())
if (event.getEventTypeId() == X ){
if (event.getChangeLog().getRelated("ChildChangeItem").find{ it.field == "status" && it.newvalue == "Z" }){
if (event.issue.getComponents().find{ it.getName() == "component A"}){
result = true
}
}
}
if (event.getEventTypeId() == 1){
if (event.issue.getStatusId() == "1"){
if (event.issue.getComponents().find{ it.getName() == "component A"}){
result = true
}
}
}
return result
Let's take a closer look.
event.getEventTypeId() == X
It is designed for transition events in "Open". How to find the value of X? Only experimental, use log.info for this (event.getEventTypeId ()).
if (event.getChangeLog().getRelated("ChildChangeItem").find{ it.field == "status" && it.newvalue == "Z" }){
If the issue status has been changed to the new value “Z”. We check only issue which 'Opened'. Value of 'Z' may find in schemes. For example when edit status in admin page in URL you see this identifier.
And last point it is check that issue has 'component A'. This condition returns true if the components of the list contain "component A".
if (event.getEventTypeId() == 1){
This is for created issue.
After we receive the 'true' of the condition, we can send an email. For example, insert a link to the body of the letter:
Issue <h1><a href="https://YOURJIRA/browse/$issue.key"> $issue.key </a></h1> with component 'component A'.
I hope this post was helpful.
B.R.
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events