Syntax question: what's with the #?

Niklas Malmberg
Contributor
October 9, 2024

I'm looking to extract information from the Sprint field on issues, getting the active sprint out of potentially several noted on an issue.
  
I've seen several posts and pages on the topic, for example: https://community.atlassian.com/t5/Jira-questions/Automating-Fix-Versions-from-Sprint-names/qaq-p/2630388  

However, I don't understand the # syntax, so I don't know how I can use statements like the one below in my automation rules. Where is this explained?   

 

{{#issue.sprint}}{{#if(equals(state,"active"))}}{{name.substringBefore(" Sprint").trim()}}{{/}}{{/}} 

A simple use case example
Screenshot 2024-10-09_000269.png


1 answer

1 accepted

1 vote
Answer accepted
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.
October 9, 2024

Hi @Niklas Malmberg 

The pound sign # is a token to indicate the start of some section, as with an iterator or condition in your example.  

You may seem more examples of iterators here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#Combined-function-examples

That example also uses smart value, list filtering: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

With smart value, conditional logic: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/

 

For the specific example you show:

{{#issue.sprint}}{{#if(equals(state,"active"))}}{{name.substringBefore(" Sprint").trim()}}{{/}}{{/}} 

What that is doing is:

  • iterate over each sprint assigned to the issue
  • using conditional filtering, only select the current active sprint
  • and assuming the sprint's name looks like this format "some text Sprint"
  • use text functions to extract that prefix text

 

Kind regards,
Bill

Niklas Malmberg
Contributor
October 9, 2024

Good explanation @Bill Sheboy, thanks. 

Is such a statement possible to assign to a smartvalue variable, like I was trying to do?  
For sure I will look into the provided links too, later today. 

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.
October 9, 2024

Yes; that expression will provide a text value which can be assigned to a variable.

Suggest an answer

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

Atlassian Community Events