Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create a specific request type ticket based on an email and parse field

Steven Lees-Smith
Contributor
May 15, 2022

Hi there,

First off, sorry for the wordy subject :)

The ITSM solution we currently use has a mail monitor built into it that takes emails and breaks parses out various elements into variables that we can use to create specific tickets.

For example we have structured our system generated alerts to have particular words in the subject to steer the info to a ticket type and we have delimiters in the Body of the email to be able to pull out words, dates, information

i.e. we can derive the host name due to having based on a rule that says within the body of the email After Hostname: and before <<end Host name it will start the value.

We are getting emails for off boarding from our HR system and through our scim connector we can totally format the email.

I want to be able to capture things like the user name, their account name, end date, notes that are all formatted in the email to be parsed out.  I am just not sure who to plug all this in to JSM to be able to catch the email, pull out variables and then to create the 'Staff Movements' ticket we have as a standard request type.

Thanks.

1 answer

1 accepted

1 vote
Answer accepted
KC Wong
Contributor
May 15, 2022

You can configure an incoming mail server for Jira, and then create mail handlers to process them. 

What you want should be possible with Script Runner's mail handler. You get access to "message" parameter which is a javax.mail.Message object of the email received. Then you can parse the message however you like, and create an Issue with it. 

Steven Lees-Smith
Contributor
May 17, 2022

ok thanks, will have to have a look and see how to break down the email using the mail handler with Script Runner, haven't touched it before.

Thanks for the pointer, I'll now go into the darkness and see what I come out with :D

KC Wong
Contributor
May 18, 2022

Script Runner allows you to specify a Groovy script, and provides a list of certain parameters... you can see the parameters if you click on the question mark icon at the lower right corner of the script editor. 

Since the mail handler gives you the javax.mail.Message object, you have access to the email data you want. 

And then you can use ComponentAccessor.getIssueManager().createIssue to create the issue. 

Steven Lees-Smith
Contributor
May 18, 2022

Thanks heaps, I just don't know enough about script runner to put all this together yet but it obviously will do what I need it to do.

Will try and find some dummies guides with examples / templates hopefully where I can plug in some variables and see this in action.

Michael diLorenzo
Contributor
September 16, 2024

Yet another "solution" that involves spending hundreds of dollars per month on another product.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events