I have a Groovy custom listener triggered on the Issue Created event.
Issues are being created by email. We have several email addresses all delivering in to the same project and issue type. Each email address is supposed to be mapped to a unique set of issue settings (assignee, watchers & some domain-specific custom fields).
Is there any way to find out in the listener code which mail server config was the creator of the incoming issue?
(This is one of the classic use cases for the JEMH plugin. I can't use that plugin, so need an alternative... would prefer not to have to write my own mail handler plugin!)
I ended up solving this in a slightly hacky way: I configured a rule on my mail server to prepend an identifer to the subject of the incoming email, depending on the address the message was addressed to. Then in the Issue Created handler (a Groovy script), extract the identifier from the ticket's summary, use it to find the table of settings appropriate for that particular address, and set as required.
Not specially elegant, but does the job.
If you are using the event object, it probably won't contain information on the incoming mail server. But if you create a simple field, and populate it with info on where it comes from
e.g. email from address A, which means it is handled by mail handler B, you can fill it with a value like Mail Server Config B. You can then get the issue object from the event, and query for the field's value to work out which config it is.
Thanks for your response Patrick. I'm a little unclear on how you're seeing the simple field being populated with information specific to the mail handler that created it? - the only fields configurable in the native mail handlers that come with JIRA are Project and Issue Type. So I can't see how I can tell JIRA to populate a field with, say, "Mail Server Config B" when the email was sent to 'address A', but (for example) "Mail Server Config D" when the email was sent to 'address C'. Am I overlooking something?
Ah, sorry, mis-read your 1st paragraph. I thought you meant you have it set up in a way where those fields are already mapped and working.
Anyway, in this case, are you able to differentiate the origin based on the reporter? i.e. each incoming email address will have a different reporter.
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
One of the newest products in the Microsoft family - Microsoft Teams, is a chat-based hub for teamwork that integrates all the people, content, and tools your team needs to be more engaged and ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG