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!)
thx
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Patrick, unfortunately I can't differentiate by reporter. Reporters are varied.
I think I'm going to have to bite the bullet and look at writing a mail handler plugin.
Thanks for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is this getting no responses because it's an incredibly dumb question or because it's an incredibly hard question? :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David - I am facing the same dilemma using Jira cloud and ScripRunner. Were you able to solve? Specifically, I would like to add a label (or component) to a newly created issue based on the email handler.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.