Forums

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

Link incoming issue via mailhandler based on the email subject(Issue summary)

YTZ September 14, 2022

Hello Everyone,

A brief description of my ask first:

We got a requirement where alerts will be generated by one of the monitoring tools and it should get created as an issue in the Jira. I've created the mailhandler which worked great but the tricky part started after that.

The customer request is like, the monitoring alerts will send 2 mail, 1st one says the problem has started and the second one says the problem is now resolved. They don't want these 2 mails to be created as two new issues in jira. They want the second email to be either linked to the already created issue or add it as a comment in the issue and both the issues status should be moved to closed.

A bit of relief is that, both their incoming alerts contain the same subject. But again the tricky part here is that, they have many services which means the alerts can be created by any of their service. In that case, I cannot use any automation to use the JQL to match the subject with a particular keyword as it varies for every service alert.

I know that scriptrunner mailhandler script https://scriptrunner.adaptavist.com/latest/jira/mail-handler.html is used to match the subject of a new incoming mail with the existing issue, but it just ignores(attached screenshot) if it matches and do nothing. But, I need to either link to the matched issue or add it as a comment to that issue if it matches.

Any help in editing the existing script to match my requirement or suggesting any automation rule would be highly appreciated.

Let me know if I've missed something or you want anything more, thanks !!scriptrunner.jpg

1 answer

0 votes
Mohamed Benziane
Community Champion
September 19, 2022

Hi,

Do you mean that the subject looks like this :"[Service name] test alert mail". I so you can try to create a regex to extract the service name and make a substring.

YTZ September 20, 2022

Hi @Mohamed Benziane 

Thanks for your response. The subject looks like the one in attached screenshot. Content after [ M7PRTGSRV01 ] will be varying according to the sensor.

So, the only possible option which I'm thinking is that to match with the already created issue in the project with the same subject and add the new incoming mail via mail handlers with the same subject either as a linked issue or as a comment.

I might be wrong, please provide your thoughts as well, thanks

MTS.jpg

Mohamed Benziane
Community Champion
September 20, 2022

Yes, i have already implement something like this, just create a regex to match the subject, if an issue exist with the same subject then add the mail as a comment if no, create a new issue.

Suggest an answer

Log in or Sign up to answer