How to display the email address of the reporter on a Jira Issue

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Purpose

The ability to see a user's email address either within the Jira issue view or using the REST API is determined by the user's profile visibility settings. In cases where a user's account is unmanaged, the user themselves own and configure profile visibility settings that administrators such as Organization or Site administrators are unable to adjust this setting. While the user's email address can be found in the Admin Hub (https://admin.atlassian.com) by Site administrators, this means integrations over API or Jira Service Management agents are not able to retrieve this information directly from Jira. Information on default profile configurations for the purposes of working with Atlassian APIs please read Atlassian's Developer Documentation on Profile Visibility.

When trying to use the Jira Cloud REST API to retrieve information on a reporter, either through the Get user endpoint or the Get issue endpoint, depending on the user's profile configurations the email address may not be returned due to these endpoints respecting privacy controls associated with a user's profile. The following feature request looks to allow administrators with the relevant permissions to retrieve this data over the REST API:

ID-7744 - Getting issue details... STATUS

Teams may have different business needs for retrieving the reporter's email address such as data analytics or using Jira filters and gadgets to aggregate the data in-app. This article will cover a method using Automations to retrieve the reporter's email address and add it to a Jira custom field so that it is visible both through the Jira issue view and the REST API.

Solution

The following workaround uses a Jira short text custom field and Jira automations to copy the reporter's email address to the field which can then be retrieved via the REST API. This is because the automation add-on is able to retrieve the user email address through smart values, which can then be used with the Jira custom field to record this value.

  1. Create a Jira custom field using the short text type. The name of this can be your choosing however for this example the field will be Reporter Email address
  2. Associate the field with the necessary Screens for the Jira Service Management project
  3. Create an Automation rule that is triggered by Field value change to the Reporter field using change type Value added
  4. In order to load the latest data into the Automation context, add a Re-fetch data action after the trigger
  5. Add an Edit issue action configuring it to edit the Reporter Email address field that was created in step one using the following smart value:

    {{reporter.emailAddress}}

The automation rule described above would look something like this:

With the above automation configured, when the reporter field is updated either during the issue creation process or if the reporter is changed after the ticket is created, the Jira custom field will be updated with the current reporter's email address. This will allow for a call over the REST API to the issue to retrieve the custom field and its value or for a user in Jira to view it through the issue view.

Jira issue view displaying the reporter's email address

In the screenshot below, the reporter's email address is visible in the Reporter Email address following the successful execution of the automation rule created above.


REST API example in retrieving the data from the Jira custom field

If using the get issue REST API endpoint with Jira you find that the reporter account is not returning an email address, it is likely the user has configured their profile settings to hide their email address.

An example response for the reporter data may look like:

        "reporter": {
            "self": "https://your-site.atlassian.net/rest/api/3/user?accountId=557158%3Af58131cb-c67d-4ec7-1309-6b58d40bd077",
            "accountId": "557158:f58131cb-c67d-4ec7-1309-6b58d40bd077",
            "displayName": "Test User",
            "active": true,
            "timeZone": "America/Chicago",
            "accountType": "atlassian"
        },

Note that emailAddress data is not returned for this user.

Following the successful automation execution, the get issue endpoint can be used to demonstrate retrieving the user's email address via the custom field that was created for a particular issue:

Request:

GET Request for custom field data on a specific issue
curl --request GET \
  --url 'https://your-site.atlassian.net/rest/api/3/issue/EXAMPLE-123?fields=customfield_10221' \
  --user 'email@example.com:<api_token>' \
  --header 'Accept: application/json'

Result:

REST API Response
{
  "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
  "id": "11670",
  "self": "https://your-site.atlassian.net/rest/api/3/issue/11670",
  "key": "EXAMPLE-123",
  "fields": {
    "customfield_10221": "test@example.com"
  }
}

The above methodology can be used with other fields such as Request participants, however multi User Picker fields will likely need to use iteration to retrieve all user data. Further information on working with lists can be found at Jira Smart Values - Lists.

Depending on the use case, additional conditions may be beneficial to set to restrict the rule to run only on certain scenarios such as for specific issue types or request type to reduce overall automation execution times. More on automation service limits can be found at Automation service limits.

It is also possible to retrieve other user's information (E.g: Display Name) using the automation smart values to display them on the Jira view as well. Please refer to the following documentation page for user's smart values that can be used: Jira smart values - users

Last modified on Jan 31, 2024

Was this helpful?

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