The JSM Mail channel creates new tickets instead of adding comments to existing tickets

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

    

Summary

In Jira Service Management (JSM) project, when a customer replies to a JSM notification (or to an email that was used to create a new ticket), the JSM mail channel should add a comment to the relevant ticket.

However, in some cases, the JSM Mail Channel might create a duplicate ticket instead of adding a new comment to the existing ticket. This KB article lists all the known root causes for this issue and how to identify each of them.

(warning) Note that this KB article only applies to the JSM mail channel (configured in Project Settings > Email Requests), and not to the Jira Mail Handler (configured in ⚙ > System > Incoming Mail).

Environment

Jira Service Management (JSM) Server/Data Center 4.0.0 or any higher version.

Explanation around how the JSM Mail Handler decides when to create a new ticket or add a comment to an existing ticket

The JSM mail channel examines various data from any incoming email to decide whether it should create a new JSM request, or add a comment to an existing JSM request:

  • If the JSM Mail Channel is able to detect any trace of an existing issue in an incoming email (via some of the headers of the email source), it will try to add new comment to the existing JSM request, based on some conditions (more details on that below)
  • Otherwise, a new issue will be created

(warning) Note that the same logic is used by both the JSM mail channel and the Jira Mail Handler. The full logic is detailed below:

For a more detailed explanation of how the mail handler looks for any trace of an existing JSM request in an email, you can refer to the panel below:

How does the mail handler look for traces of existing Jira issues in an incoming mail

The mail handler checks 3 places/headers in the source of the email to determine whether it should create a new issue or add a comment to an existing issue:

  • the mail Subject line (Subject header):

    • the mail handler looks for an issue key in the subject, and if there is a matching issue in Jira, a comment is added to this existing issue. If no issue key is found, it moves on to the next step.

  • the In-Reply-To and References headers:

    • the mail handler tries to detect if there is any message-ID that is linked to an existing Jira ticket. If any message-ID is found in the 2 headers above, the mail handler will analyze it and try to map it to an existing Jira ticket

    • if the message-ID has the format "JIRA.12700.1562154694000.1.1562154780223@Atlassian.JIRA"

      • the ID after "JIRA" (in this case 12700) is compared to the id column of the database table jiraissue

      • if an existing row is found in the jiraissue table, then a comment is added to the existing ticket

      • (info) Note that the message-ID will have this format if a user replies to a notifications email received from a Jira issue
    • if the message-ID has any other format

      • this message-ID will be compared to the ones stored in the database table notificationinstance.

        • This table contains all the email message-IDs that have been associated with each Jira ticket (whether the email was used to create the issue or add a comment to that issue)

      • if there is a match, then a comment will be added to the corresponding issue

      • (info) Note the message-ID will have a random format in case the user replied to an email that was originally used to create a new Jira issue

If the JSM Mail Channel detects that the incoming email is linked to an existing JSM request, it will try to add a comment on behalf of the sender of the email. Please note that it is only possible if the sender of the email has access to the JSM request by being:

  • either the reporter of the request
  • or a request participant of the request
  • or part of any organization the request is shared with
  • or one of the approvers of the request (if the case the request was configured with an approval status)

If the sender of the email does not have any Jira account, does not have access to the Customer portal, or does not have access to the JSM request, the following will happen:

  • no comment will be added to the existing ticket
  • depending on various conditions, either the email will be dropped, or a new ticket will be created from this email

Root Cause

Root Cause 1 - The sender of the email does not have a Jira account, nor access to the JSM Customer Portal

If the sender of the email does not have a Jira account, or does not have access to the Customer Portal (where the JSM Mail Channel is configured), the following will happen:

  • this user will be considered as a non-customer (or external user)
  • if the JSM Mail Channel is not allowed to add comments from external users (based on the Public email comment setting from ⚙ > Applications > Jira Service Management > Email Requests):
    • it will not add a comment to the existing request
    • instead, it will try to create a new request on behalf of this user (provided that this user is allowed to raise requests in the JSM project where the Mail Channel is configured)

Root Cause 2 - The sender of the email has access to the JSM Customer Portal, but does not have access to the JSM ticket

For a user to have access to a JSM ticket, this user needs to be involved in the ticket by being:

  • either the reporter of the request
  • or a request participant of the request
  • or part of any organization the request is shared with
  • or one of the approvers of the request (if the case the request was configured with an approval status)

If the user has access to the Customer Portal, but is not involved in the ticket, the following will happen:

  • this user will not be considered as a non-customer (or external user), since this user has access to the Customer Portal
  • however, since this user does not have access to the ticket, the Mail Handler will instead create a new ticket on behalf of this user

(warning) Note that the Public email comment setting from ⚙ > Applications > Jira Service Management > Email Requests) will not have any effect on this user, since this user has Customer Portal access, and is not considered as a "non-customer (or external user)".

Root Cause 3 - There is an invalid Field Context Configuration

There is a field in the configuration of the the Request Type (associated with the JSM Mail Handler) which has an incorrect context configuration. To ensure that the Mail Handler works as expected and creates issues/comments from incoming emails adequately, the field context needs to include both:

  • the Service Management project this request is configured in
  • and the issue type associated to the request type used by the Mail Handler

This issue is a side effect of the Service Management bug JSDSERVER-7061 - Getting issue details... STATUS

You can find more information about this Root Cause in the KB article The JSM Mail Handler creates new tickets instead of adding comments to existing tickets due to invalid field context configuration Skip to end of metadata.

Diagnosis

Diagnosis for Root Cause 1

Check if the sender of the email:

  • has a Jira account (in the page ⚙ > User Management > Users)
  • and also has access to the Customer Portal where the JSM Mail Handler is configured (as per the Project Settings > Customer Permissions setting)

If the sender of the email does not have access to the Customer Portal (or does not have a Jira account at all), go to the page ⚙ > Applications > Jira Service Management > Email Requests and check if the setting Public email comments is set to No as shown in the screenshot below:

If the Public email comments is set to No, then the Root Cause 1 is relevant and you can move on to the Solution for Root Cause 1 section.

Diagnosis for Root Cause 2

Check if the sender of the email:

  • has a Jira account (in the page ⚙ > User Management > Users)
  • and also has access to the Customer Portal where the JSM Mail Handler is configured (as per the Project Settings > Customer Permissions setting)

If the sender of the email has a Jira account and access to the Customer Portal, check if this user is involved in the JSM ticket by being:

  • either the reporter of the request
  • or a request participant of the request
  • or part of any organization the request is shared with
  • or one of the approvers of the request (if the case the request was configured with an approval status)

If this user is not involved in the ticket, then Root Cause 2 is relevant, and it is expected that this user cannot add comments to the ticket, since this user does not have access to it. You can move on to the Solution for Root Cause 2 section.

Diagnosis for Root Cause 3

Please refer to the Diagnosis section of the KB article The JSM Mail Handler creates new tickets instead of adding comments to existing tickets due to invalid field context configuration Skip to end of metadata for more information.

Solution

Solution for Root Cause 1

To fix the issue, you will need to allow non-customers (external users) to add comments by email to requests they don't have access to.

To do this, go to ⚙ > Applications > Jira Service Management > Email Requests and set the Public email comments setting to Yes as shown in the screenshot below:

(warning)  Important note: These configurations are global and the changes made will take effect on all JSM projects so please be informed.

Solution for Root Cause 2

Solution 1

One solution consists in adding the sender of the email as a request participant of the existing JSM request. By doing this, this user will be allowed to access the request, but also allowed to add comments to this ticket. This can be done by opening the requests from the customer portal view, and by using the share button.

Please make sure that the setting Who can customers share requests with is set to Any customer or organization, by searching in this project in the affected project > Project settings > Customer permissions page.

Please go through the documentation Managing access to your service project for more details about this setting.

Solution 2

Alternatively, what you could do is:

  • Create a new organization in the Customer Portal
  • Group in this organization all the users that should have access to the same tickets
  • Share the request is with this organization

By doing so, all the customers who are part of the same organization will be able to access and comment in requests shared with that organization.

Solution for Root Cause 3

Fix the Field Context Configuration. Please refer to the Solution section of the KB article The JSM Mail Handler creates new tickets instead of adding comments to existing tickets due to invalid field context configuration Skip to end of metadata for more information.




Last modified on Feb 1, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.