Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Enforce new issue being created at all times except when subject contains a issue reference?

Hello all, hoping someone can perhaps help or has come across this before.

Jira service management 4.22.3 on-prem server.

We get a large subset of our issues come in via email handler which works a treat for the most part. Occasionally however we will have a user who will use one of their previously sent emails (Email 1), do a reply-all of it and add a new subject line and content to the body making it (Email 2).
This email (Email 2) will then be updating Jira issue ticket with a comment on the ticket generated from (Email 1) due to Jira looking at message ID's on incoming emails.

Is there a way to enforce JIRA Service Desk to always generate a new issue ticket Unless the subject Line of the email has the Key of the project in it?

A more exact example of the issue:
User Ann O - emails with
Subject: Terminate Account Joe Bloggs 18 Aug 2022
BODY: Please Terminate Account Joe Bloggs on date 18 Aug 2022

This will generate a JIRA Issue with key SUPP-12345

2 weeks later User Ann O will use her original email sent above do a reply-all but update all fields apart from TO and CC (which are static)
User Ann O - emails with
Subject: Terminate Account Jane Doe
BODY: Please Terminate Account Jane Doe on Date 1 Sept 2022

This email will then update JIRA issue SUPP-12345 as JIRA has read the message ID and assumes its a comment of the original ticket - which it isn't.

Is there any way to always create New Tickets unless the subject line of the email specifically has the JIRA issue key of SUPP-##### in it , and if it does have the SUPP-#### then update the comments of SUPP-##### 


1 answer

1 accepted

2 votes
Answer accepted

Hi Jonas

This could be done easily if you have any of the scripting plugins like JMWE or Scriptrunner

Edit the workflow mapped with the email request type and add a validation on the create step

Screenshot 2022-08-19 100543.png

Add a custom script validator if you are using script runner

import com.opensymphony.workflow.InvalidInputException; 
import java.util.regex.Pattern;
import java.util.regex.Matcher;

Pattern p = Pattern.compile("(.*)SUPP-[0-9]*(.*)");
Matcher m = p.matcher( issue.getSummary() );
throw new InvalidInputException();

This will validate if the summary contains an issue key SUPP-[0-9], if it contains an exception will thrown

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events