On the forum I saw a bunch of posts that explain how to setup an event listener and add this to the transition of the project's workflow. My goal is to do almost the same. I would like to sent an email to a custom email address when the assignee field is changed from unassigned to a person and also from a person to unassigned. The problems I faced when using solutions from other forum topics:
1) When using issue.assignee != originalIssue.assignee the event only seems to trigger from unassigned to assigned, but not on assigned to unassigned. Could be a Script Runner issue or improperly configured by me.
2) The Send a custom email was configured in the addon section, but when later trying to add it to a transition, I am unable to select the pre-configured event. The fields are all blank and it looks like I would need to configure this addon each transition post event. I have about 30 transitions :)
3) Is there no way to specify the project and sent an email based upon the assignee field changing generally? Because there will be cases where there is no transition upon changing the assignee. I have a project based on this guide: https://www.atlassian.com/blog/jira-service-desk/free-ebook-jira-service-desks-guide-asset-management
Any suggestions are very welcome!
Jira version: v7.1.7#71011
Hello,
I assume you are using script runner for this purpose.
When you configure a Send a custom email script listener, you don't need to add it to your transitions. Script listener, as the name suggests, listens to the events that you define and runs when that event occurred. What you are referring I presume is adding the event to your transition and than adding it to your notification scheme. Send a custom email is a script listener.
Regards,
Elifcan
Well that is basically what I want, an even (Email) triggered without the use of transitions. That would be lovely. What about the first question? :) I noticed the event triggered twice when changing the assignee field 4 times. (2x unassigned to assigned, assigned to unassigned)
Also it does not send an email although SMTP test emails arrive.
Thanks so far!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
For the first question I think you need to write a custom script that uses change history manager. If you get the previous assignee and compare it to the current assignee, it should work from unassigned to assigned and vice versa.
Why it doesn't send an email is probably related to the configuration of the script listener. I don't have enough info to guess why it is not working. You can check the email queue and the logs of the outgoing mails. See if it is trying to send the mail or there is no mail at all.
Regards,
Elifcan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Elifcan,
You definitely helped me a lot, it pointed me to a solution. It even sends out the mail!
I managed to find this after googling ChangeHistoryManager:
From there I setup this script listener:
// Gather changed field at the Issue Updated
def field = event.getChangeLog().getRelated('ChildChangeItem').find{it.field == "assignee"}
field.newstring != field.oldstring
It listens to events: Issue Updated, Issue Assigned and Issue Reassigned
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I'm glad it helped :)
Regards,
Elifcan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.