How to use # syntax ?

Niklas Malmberg
Contributor
October 9, 2024

I want to search in sprint field and find the active sprint information.
I've found suggestions here https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#Combined-function-examples , but I don't understand how the proposed solutions could be used. So I'm looking for info to read up on how the # (hash) syntax really is working. Pointers please.  

What I would like to do is something similar to this, but obviously, I'm not using this right since I get syntax error
Screenshot 2024-10-09_000269.png

2 answers

0 votes
Marc - Devoteam
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 

I don't really get your request.

to find active sprints, you van use JQL sprint in OpenSprints()

The # can be used to combine functions over a list of found issue/values like when using a lookup function. 

I haven't ever seen this used in creating a variable as a variable is create to be used in other automation actions or conditions

Niklas Malmberg
Contributor
October 9, 2024

Sorry for being unclear. 

I'm looking for a way to extact a name of of a sprint from an issue.

If an issue has been on the board during more than one sprint, the Sprint field will contain a list, several entries. And the order of those list entries is not defined/known, so it's not certain that first or last will give me the active sprint name. 

I've read that there is a way to search for which sprint is considered active instead, and I found some examples on community pages where such filtering was done. 
But I don't understand how to perform that kind of operation, since I don't understand the # syntax. 

Once I get the active sprint name out, I can proceed with my automation rule where I will use this text.
A simple way to illustrate how I would like to use it was my example, where I want to assign the (single) name of the active sprint to a smart value variable. 

Is there a way to rewrite my rule so that it can - from a list of sprint names residing in the Sprint field on the trigger issue - find the active sprint and assign that name to a smart value?

Marc - Devoteam
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 

So you first need to lookup issues to find the sprint name

Try the following:

expression with your lookup issues action:

{{#lookupIssues.first.sprint}}{{#if(equals(state,"active"))}}{{name}}{{/}}{{/}}

How this works:

  • assuming your lookup issues has JQL to find the issues in the open sprint, such as with:
    • project = myProjectName AND sprint IN openSprints()
  • we only need to look at one issue, so we can use the first one
  • then we iterate over any of the sprints the issue has been assigned to
  • and using smart value, list filtering, only select the one(s) with the active state
  • finally returning just the name of the sprint

 

So to summarise:

  1. Set your rule trigger
  2. Add a lookup action -> example JQL: project = myProjectName AND sprint IN openSprints()
  3. create a variable -> smart value: {{#lookupIssues.first.sprint}}{{#if(equals(state,"active"))}}{{name}}{{/}}{{/}}
  4. Add a log action, show the varible output
Niklas Malmberg
Contributor
October 9, 2024

Nice. I defined this rule
Screenshot 2024-10-09_000270.png

and the output was the active sprint name. Great ! 

I used a manual trigger on a ticket on the active board, and as far as I understand it, the lookupIssues.first will return the first ticket (however 'first' is defined here) in the set of tickets that are on the board.
Then the sprint object (list) is extracted.
And lastly, the list of names are searched through to find the active sprint name. Correct? 

Now, in order to understand more, I still want to learn what this #-notation really means, so I can understand how it should be used.
Do you know where I can read up on that? 


Marc - Devoteam
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 # symbol is used to apply the rule to each individual component found in a lookup for example.

No first indicates in the lookup the first found active sprint and prints the name of that sprint

0 votes
Niklas Malmberg
Contributor
October 9, 2024

The search example was taken from this post: https://community.atlassian.com/t5/Jira-questions/Automating-Fix-Versions-from-Sprint-names/qaq-p/2630388 by @Bill Sheboy , and it should accomplish pretty much what I need.
If I only understood how it could be applied in my context.  

Suggest an answer

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

Atlassian Community Events