Hello I need to send a mail, when a customfield ("Group") gets changed. I already got the following, which gets processed without any ERROR but no mail is sent. Am I missing something?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption;
if (event.getChangeLog().getRelated('ChildChangeItem').find { it.field == ("Group") } ) {
ComponentAccessor.issueEventManager.dispatchEvent(10000L, event.issue, event.user, true)
}
EDIT: We also use Email This Issue and in the specific project we run this script listener, we already configured a mail template and a context / notifications with the given event (10000).
Hello
1) Try to enable logging for your listener and check what is worng.
Below is an example how to enable logs:
import org.apache.log4j.Category;
log.setLevel(org.apache.log4j.Level.INFO)
log.info("start logging ....");
2)Try dispatchEvent(IssueEventBundle) method
From Jira API https://docs.atlassian.com/software/jira/docs/api/8.1.0/
...
dispatchEvent(IssueEventBundle issueEventBundle)
Dispatches a bundle of issue events.
...
dispatchEvent(Long eventTypeId, Issue issue, ApplicationUser remoteUser, Comment comment, Worklog worklog, org.ofbiz.core.entity.GenericValue changelog)
Deprecated.
since v6.4.10, please use dispatchEvent(IssueEventBundle).
Thanks for your response,
how dos this method work? I mean what should be standing inside the brackets "()" to dispatch that specific event "10000". I don't code very much, so I don't really know what parameter (IssueEventBundle issueEventBundle) is.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
As you can see from description, you can get IssueEventBundle from IssueEventBundleFactory interface
Check this topic https://community.atlassian.com/t5/Jira-questions/Is-it-technically-possible-to-fire-an-event-without-updating-an/qaq-p/317043
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok thanks alot,
it worked somehow, and with logging, i can now se that all my code gets processed. The problem now is, there is still no email sent. Am I still missing something? I mean, event gets fired, I created a "Notification" for that event and a "Template" in Jira Email this Issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Discover how Atlassian is revolutionizing service management with cutting-edge solutions for AI-powered support, HR Service Management, or DevOps connectivity.
Register here ⬇️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.