Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Use smart values to access an array Edited

Hi all.

I'm trying to access the Affect Versions field in JSD support ticket and post it in a Slack notification.

 

Using the smart values and reading the document here: https://support.atlassian.com/jira-software-cloud/docs/use-smart-values-to-access-listed-values/

My automation rule log is not able to pick up the value in the Affect Versions field.

Using the REST API browser I can see the following:

"versions": [{"self": "https://my-domain.atlassian.net/rest/api/3/version/14214","id": "14214","name": "1.9.0","archived": false,"released": true,"releaseDate": "2020-06-03"}],

 

I thought that the smart value will be {{versions.name}}, but since this is an array, I was trying to use 

{{issue.versions.name.join(", ")}}

or

{{#issue.versions}}{{name}} {{/}}

but nothing seems to pick up the version name from that array.

 

Appreciate your help.

 

 

2 answers

1 accepted

1 vote
Answer accepted

Just for other community members benefit, posting the answer I have provided to Gil in Support ticket.

This is how we can get version name and release date values from Affects Versions system field using smart values.

To get the version name, use:

{{issue.versions.first.name.asJsonString}}

And for version release date:

{{issue.versions.first.releaseDate}}

Screenshot:

Screen Shot 2020-09-30 at 3.08.38 pm.png

If you want to get rid of double quotes from version name, use:

{{issue.versions.first.name.jsonEncode}}

 

0 votes

Hey there Gil,

Most of our smart values matches the data returned through REST for the issue, i.e. through /rest/api/2/issue/ISSUEKEY-1?expand=names,renderedFields,changelog

More specific examples can be found at:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/

In your specific case, the right field name is actually version not versions so, for affects versions, you should be able to do:

{{issue.version.name}}

And it will concatenate the affect versions.

Cheers,

Mark C

Hi @Mark Chaimungkalanont 

Thanks for the answer.

According to your documentation, the examples listed there use the value Versions and not Version.

See:

image.png

(source: the link you provided)

 

So which one is it? Do you need to amend your documentation?

 

---

Whether it's Version or Versions, given the Affect Versions is a list, would this be a correct way to do this?

{{#issue.versions}}{{name}} {{releaseDate}}, {{/}}

Or is this the correct way?

{{#issue.versions.name}} {{releaseDate}}, {{/}}

 

Update:

I tried all of these combinations and none of them work:

Version: {{issue.version.name}} | {{issue.versions.name}} | {{issue.version}} | {{versions.name}}

The LOG returned empty results.

 

Ah sorry, my bad. Looks like we've got wrong and right documentation on that page. 

Smart_values_-_general___Jira_Software_Cloud___Atlassian_Support.png

We'll get that fixed up

--- 

{{#issue.versions}}{{name}} {{releaseDate}}, {{/}}

 

This is the correct style (the # sets the object as the main object inside that context)

We do some smart defaults so if you want a simple value we auto-concatenate the strings, so {{issue.versions.name}} will output Version 1, Version 2

@Mark Chaimungkalanont  I'm getting empty results.

The LOG lists nothing.

image.png

Hi @Mark Chaimungkalanont 

I tried this whole weekend to get the log to show the Affects Versions.

Can I please get your assistance on this one?

See my above screenshot. It is empty.

Hey there Gil,

Sorry to hear... That smart value works fine for me so it's probably something specific here. Does outputting {{issue.versions}} show anything? Is your issue using the system Affects Versions or is it a custom field of type version?

Can you raise a support request at https://getsupport.atlassian.com/ and we can check it out on your instance.

Cheers,

Mark C

Thank @Mark Chaimungkalanont 

Raised PCS-17865

Cool I'll follow up there. Looks like a weird one

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

227 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you