Can't access Custom Field value in Jira Automation

Robert Werner February 16, 2018

I've created a custom field in Jira called "Organization".  Internally its customFieldId = 10539.  It's a simple drop-down listbox where one string value inside can be selected.

In Jira Automation I've added a new action that sends a Slack message to a particular Slack channel.  In general it works fine but I'm struggling to get it to send the newly set value of "Organization".

Here's an example of the the overall message I want to send:

Issue <https://mycompany.atlassian.net/browse/{{issue.key}}|{{issue.key}}> has had its Organization field set to: {{issue.customfield_10539.value}}

But everything I've tried to represent the custom field value has so far failed.  Here's what I've tried:

  1. {{issue.Organization}}
  2. {{issue.organization}}
  3. {{issue.Organization.value}}
  4. {{issue.organization.value}}
  5. {{issue.customfield_10539}}
  6. {{issue.customfield_10539.value}}

But not one of them displays the value of "Organization".

Incidentally, this was one of my prime references: https://docs.codebarrel.io/automation/smart-fields/advanced-fields.html

Any ideas on what the correct syntax might be?

Robert

4 answers

3 accepted

2 votes
Answer accepted
Richard Vencu June 3, 2020

It seems to work for me like this

{{issue.fields."paste your field name here".value}}

When the field is text just omit the .value part...

DJ June 9, 2020

It worked for me like this.

Thanks

Allan Schwarb December 12, 2020

The following Jira Cloud Project Automation Send Email via a custom field worked for my custom field:

{{issue.customField_10628}}

Where my customField ID, 10628, is located as follows:

Settings >> Issues >> Custom fields >> Details tab >> Edit details >> Edit Custom Field Details >> Address bar:

  ... .atlassian.net/secure/admin/EditCustomField/default.jspa?id=10628

Therefore, the following syntax worked to extract an email address via a Custom Field Text Field (single line):

{{issue.customField_ID}}

Like jiraadm likes this
Richard Vencu December 12, 2020

For me it always worked with the field name, it might work even without quotes. In case the field appears in any screen, just copy it's name like this:

2020-12-12_22h58_07.png

For the above example just use: {{issue.fields."SNOW Group"}}

Like Allan Schwarb likes this
Leroy Heritage March 15, 2021

I tried @Richard Vencu suggestion but that did not seem to work for me, but with a slight variation it worked: {{issue."SNOW Group"}}

Nicholas Wolf June 14, 2021

@Allan Schwarb  Seems like you've found a solution for this. 

Not sure if this will work for all, but the way I've found easiest to find the custom field ID is to use the rest API method: 

https://OrgName.atlassian.net/rest/api/2//issue/ProjCode-####

This  will essentially give you the entire page- from  there I search for what Ihave entered in the field and cross check to see that I have the correct ID  (checking if the value if duplicated anywhere else)

Screen Shot 2021-06-14 at 2.31.26 PM.png

Actually just found the article I believe I learned this trick from:

https://blog.codebarrel.io/how-to-use-smart-values-in-automation-for-jira-15edddfb8c7c

0 votes
Answer accepted
Alex Christensen
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 7, 2018

Hey @Robert Werner - I happened to be reading the release notes for newer versions of Automation for Jira and thought of this thread. In version 3.8.1, the release notes are:

In our previous release we broke some smart-values for service desk related fields (specifically Organizations & SLAs). Now {{issue.Organizations.first.name}} works again!

Not sure if you're still facing this issue, but thought I'd share since I was reminded of this! :)

Robert Werner March 8, 2018

Thanks, Alex.  However, I have already gone down the route of creating a custom "Organization" field and it seems to be working fine.

0 votes
Answer accepted
Robert Werner February 20, 2018

Alex, I tried a few more things but none worked.  So I just ended up creating one sub-rule for each of our customers - ex. "ABC", "DEF", XYZ", etc.  The string being sent to Slack is simply the hard-coded version of each customer's name.

It's not elegant but it works.

Alex Christensen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 22, 2018

Ah, okay, that definitely works!

Another solution that just popped into my head - you could create a rule that checks a filter every 5 minutes, then posts the message to Slack using the Organization field as a variable, not hard-coded. I think this would give the system enough time to index the value inputted into that field.

Either way, glad you found a working solution!

Robert Werner February 22, 2018

@Alex Christensen: You are a great wealth of information, sir!

I was not aware of Scheduled rules until now.  Many possibilities!

Mahalo.

0 votes
Alex Christensen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 17, 2018

Weird. I do something similar with a user field called "Coder" and I use the same syntax you do in #1 ({{issue.Coder}}). This works fine for me. I can also display a custom field value from a single-select dropdown using the syntax in #3 (I put my custom field name in quotes since the field is two words - might try that on yours just in case the quotes are needed for some reason).

What is the action that triggers the automation? I was able to create a scenario that if the field value was input during the action you initiated, then the Slack message won't post the value. In my example, I send a Slack message to a private channel when I closed a ticket and tried to display a custom field value for a single-select field, but the value won't display. My guess is that this happens because the value isn't indexed in the database by the time this automation is triggered, so there's no value for this field for this issue in the database.

If that's the case, you might try messing around with different actions if you are able to achieve the same goal with another action. Might also be worth reaching out to CodeBarrel to see if they can provide support if you haven't already done that.

Robert Werner February 20, 2018

Alex, in my case when a specific string - say "abc" - is entered into the summary or description fields then that same string (think company name) is selected in a single-choice dropdown listbox.

I had not yet tried anything with putting quotes around "Organization".  I could try that.  Failing that though, I wonder if what you said in your 2nd paragraph is the reason, namely that the value hasn't yet been set.  Perhaps there's a way in Jira Automation for me to save the value into a temporary variable and then reference that when I send the message to Slack.

Suggest an answer

Log in or Sign up to answer