Getting custom field value in an email and assign it to new ticket through mail handler?

I'm trying to create a custom mail handler that works like mail handler provided by JIRA but with extra features which allow mail handler to capture the custom field value in the email and automatically assign these values to the corresponding custom field.

Is it possible to do so by creating a new plugin or I have to do it through script? 

2 answers

0 vote

Mail handlers are mostly implemented as add-ons, and that is the easiest way to do it.  Scripting depends on what scripting add-ons you have installed.

There's a few resources I'd point you at, but as you say you want to create a handler, I suspect a walkthrough of coding one as an add-on is the best start - https://developer.atlassian.com/jiradev/jira-platform/guides/email/tutorial-custom-message-mail-handler-for-jira

I had gone through the tutorial and created a plugin based on the tutorial but what the tutorial taught is no where enough to satisfy what I wish to have in my custom handler.

The tutorial is there to show you how to get the data from the incoming email. What you do with it is another step. All you've said is "capture custom field" - that's fine, but your code needs to call issue.setCustomFieldValue(cf, value) with good data to do that. Ok, you need to work out what cf is in there - it's a customfield object, and I usually use customFieldManager.getCustomFieldByName("my custom field") to fetch that, but there may be better ways. The bit I can't help you with is the value. The example code exposes all the data in the incoming email. What you process that into, I can't tell you.

The value you mentioned in issue.setCustomFieldValue(cf, value) is the value we obtained (for instance, "issueKey = params.get(KEY_ISSUE_KEY)" taught in tutorial) ?

Hi Yeoh, 

I tried myself the JIRA Email This Issue Plugin. You are able to define rules for initialisation of fields.

http://www.meta-inf.hu/wiki/display/PLUG/Field+Contexts

Plugin: https://marketplace.atlassian.com/plugins/com.metainf.jira.plugin.emailissue

Hope it helps.

Cheers, 

Mario

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Hipchat

Moving from Hipchat to Stride? Here’s what you’ll love

Heya, Hipchat friends! We’re so happy you’re checking out   Stride. Whether you know it or not, you have been instrumental in making Stride come to life. Every feature, design, and functionality...

75 views 2 6
Read article

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you