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:
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
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...
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}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
For the above example just use: {{issue.fields."SNOW Group"}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried @Richard Vencu suggestion but that did not seem to work for me, but with a slight variation it worked: {{issue."SNOW Group"}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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)
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Alex. However, I have already gone down the route of creating a custom "Organization" field and it seems to be working fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex Christensen: You are a great wealth of information, sir!
I was not aware of Scheduled rules until now. Many possibilities!
Mahalo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.