Associate inbound email with existing ticket, don't create new ticket

Gamal Lear March 28, 2024

Hi there. We're in the process of migrating from Freshdesk to JSM Premium and will be migrating all our existing tickets across. As part of that migration process, we will put the Freshdesk ticket ID into a custom field on the issue within JSM, so we have a record. The challenge we have is that once we go live on JSM, if any customer sends an email on a ticket that was originally opened in Freshdesk, then the subject line will have the Freshdesk ticket ID in it, not the JSM issue key, meaning that JSM will consider it a new ticket, rather than a reply to an existing open ticket (that was migrated).

Is there any way of considering these emails as replies to the tickets that are open in JSM via the migration, through some sort of automation rule or similar? I had hoped we could look to match the presence of the FD ticket ID in the subject line with the same value in the custom field of the JSM issue and use that to identify the issue to associate the email with, but I'm not sure if that will work or if there's a better option: I imagine this must be a common challenge for businesses where it is not possible to duel run on 2 ticket systems (as some of our tickets remain open a long time).

Any help/suggestions gratefully received!

1 answer

1 accepted

2 votes
Answer accepted
Kris Dewachter
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 28, 2024

Hi @Gamal Lear ,

It happens that i'm currently working on a similar issue. I've solved this with a simple automation rule that is triggered once a new ticket is created in Jira.

The rule will try to retrieve the ticketnumber from the summary by using substring in a smartvalue. Ex. {{issue.summary.substringAfter("#")}}   (in this example, the ticketnumber appears after the #-sign).

Then, i added a branch in my automation rule that finds the ticket by using a JQL

Once found, I add the content of the trigger issue as a comment to the existing ticket.

Then, I delete the trigger issue.

Hope this helps,

Best regards,

Kris

Gamal Lear March 28, 2024

Hi Kris, thanks so much for taking the time to share that, it certainly sounds like what we are looking for! Would you be kind enough to share a screenshot or two of the JQL and the rule step for adding the contents of the trigger issue as a comment on the existing ticket? Given it's working well for you, I'd love to replicate the exact approach and do some testing at this end.

Thanks again,

Gamal

Kris Dewachter
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 28, 2024

Hi @Gamal Lear ,

Sure. After the trigger, I use a "Create Variable" action to extract the ticketnumber from the "Summary" of the ticket. In this example, the ticketnumber appears after the #-sign.

 

Screenshot 2024-03-28 at 16.36.25.png

I also save the "Description" in a variable.

Screenshot 2024-03-28 at 16.37.00.png

 

Then I create a Branch and use a JQL command to retrieve the ticket. The JQL will be different in your case because you store the ticketnumber in a custom field.

Screenshot 2024-03-28 at 16.40.25.png

 

Screenshot 2024-03-28 at 16.42.11.png

 

And I use the "Add Comment" action to add the description as a comment to the ticket

 

Screenshot 2024-03-28 at 16.43.16.png

 

Best regards,

Kris

 

Gamal Lear March 28, 2024

Thanks again Kris, that's awesome. All makes complete sense. Just one final question if I may! In my situation, the email subject has the Freshdesk ticket ID that following the format [#123456] - so I want to extract the 123456. Substring can be used like you suggest but I end up with 123456] - do you know the syntax to drop the trailing ] after the final digit?

Kris Dewachter
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 29, 2024

Hi @Gamal Lear ,

Please give the "substringBetween" option a try:

{{issue.summary.substringBetween("e","d")}}

Best regards,

Kris

Gamal Lear April 2, 2024

Thanks Kris! That does seem to work but I've been struggling to get the JQL to parse. I've tried various operators as well as both numeric and short text field types for versions of the below, where Grouptextfield is the custom field on the ticket we want to find and FDTicketID is the variable that holds the Freshdesk ID extracted via the above substring:

Screenshot 2024-04-02 084953.png

No matter what I do, I get the error below - it must be a syntax error where it is not including the variable in what's being evaluated. Any ideas what I might be doing wrong?

Screenshot 2024-04-02 084854.png

Gamal

Kris Dewachter
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 2, 2024

Hi @Gamal Lear ,

Your JQL seems valid.

Does your variable FDTicketID only contain the ticketnumber, or also something more? Have you tried displaying the value in the audit log of the automation rule ?

Best regards,

Kris

Gamal Lear April 2, 2024

I managed to debug it and it appears to be working well! Top stuff, thanks for all your help Kris.

Like Kris Dewachter likes this
Kris Dewachter
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 2, 2024

Hi @Gamal Lear ,

Good to hear you got it working.

By clicking the green 'Accept Answer' button you can help other community members identifying helpful posts.

Thank you

Best regards,

Kris

Gamal Lear April 2, 2024

Will do @Kris Dewachter - you don't happen to know how to delete the trigger issue, as opposed to the issue that is getting the contents of the variable added to it do you?

Kris Dewachter
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 2, 2024

Have you tried adding the "Delete Issue" action at the end of the automation rule, outside of the branch ?

Screenshot 2024-04-02 at 20.25.33.png

Gamal Lear April 3, 2024

Every day's a school day - yes, outside the branch does the business. I'm sorted now - thanks for the education! :-)

Like Kris Dewachter likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events