Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to show Custom Field Name in JIRA Automation Email

Digvijay Singh Gehlot
Contributor
May 31, 2024

Hi Team,

I have created a custom Text Field (single line).

I want to show the custom field NAME in the Email send from JIRA automation when issue transitions from one status to another.

I tried multiple time to pass the below syntax, but failing to show the custom field name in outgoing email.

Failed ones:

1) {{issue.customField_XXXXX.value}}

2) {{issue.customField_XXXXX.name}}

3) {{customField_XXXXX.name}}

4) {{customField_XXXXX.displayName}}

5) {{issue.customField_XXXXX.displayName}}

Only this was successful but it is showing the value of custom field - I want to see the Display Name of the custom field:

{{customField_XXXXX}}

Please provide a correct syntax of how to show the Name of the custom field in jira automation.

Thank you

2 answers

0 votes
Victor - Modus Create June 7, 2024

Hi @Digvijay Singh Gehlot  ,

Based on what you've described, I'd say that Notification Assistant for Jira might be an alternative for you to reach out your goal:

https://marketplace.atlassian.com/apps/1211069/notification-assistant-for-jira-email?hosting=cloud&tab=overview

It might help you even showing different field values on the notification if needed.
Hope it helps.
Cheers,
Victor

0 votes
Trudy Claspill
Community Champion
May 31, 2024

Hello @Digvijay Singh Gehlot 

I found an older post that asked the same question but had no validated solution.

https://community.atlassian.com/t5/Automation-questions/Jira-smart-values-custom-field-properties-not-showing/qaq-p/2034869

According to the documentation {{issue.[Custom field].name}} should work.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--issue.

However when I tested this on my own system, no information was returned. I was testing with a Global custom field of a native custom field type (not a custom field in a Team Managed project, nor a custom field where the type was supplied by a third party app).

So far I have not found an issue in Atlassian's public backlog about this.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2024

Hi @Digvijay Singh Gehlot and @Trudy Claspill 

This smart value is documented as working for Jira Cloud and Server / Data Center, and here is the open defect for it not working for Cloud:

https://jira.atlassian.com/browse/AUTO-1069

Looking at the REST API for Cloud, it appears the names are only returned when the expand=names parameter is passed.  And so a workaround would be to call the REST API to get the name.

Kind regards,
Bill

Like Trudy Claspill likes this
Digvijay Singh Gehlot
Contributor
June 1, 2024

Hi @Bill Sheboy 

Thank you for your message.

May you guide me on how I can use REST API to get the name of the custom field via Jira automation? 

Any screenshots, help docs or step by step process will be a great help.

Thanks,

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2024

First thing, as you are already referencing the custom field by its ID value, I recommend just hard-coding the field name.  That will be much simpler and more efficient for an email action.

 

Regarding how to do this with the REST API instead...

  • Using a Send Web Request action, the rule will call the REST API to get the issue with the expand=names parameter
https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
  • Add an advanced compare condition (i.e., smart value condition) to check that the request worked by checking {{webhookResponse.status}}
  • To get the name for a field, look it up in the names attribute of the response for your field.  For example:
{{webhookResponse.body.names.customfield_12345}}

 

Here are some references to help...

How-to article for calling a REST API function with Send Web Request:
https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

The specific function to call:
https://docs.atlassian.com/software/jira/docs/api/REST/9.13.0/#api/2/issue-getIssue

An example showing a call to that function:
https://confluence.atlassian.com/automation/find-the-smart-value-for-a-field-993924665.html

 

Like Digvijay Singh Gehlot likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events