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 !!
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