Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation - Smart Values - If more

Melissa C
Contributor
August 6, 2025

Hello, 

I have a rule that is copying FixVersion from Project 1 to Target Quarter in Project 2, when FixVersion is updated.  This is working correctly.  

I'm using the below to only copy output that have "Q" - The reason for this is that in FixVersion we use ProjectXZY, 25-Q4, 25-Q3, 25-Q2. The below will only copy anything that contains a "Q" -- this is working
{{#triggerIssue.fixVersions}}{{#if(name.contains("Q"))}}{{name}}{{^last}}, {{/}}{{/}}{{/triggerIssue.fixVersions}}

Now I want to modify so if the Output has more then 1 Q then it should updated the Target Quarter field in Project 2, with Needs Attention.   

Any help would be appreciated?

I've tried a couple of variations of this, but can't figure it out. 

{{#triggerIssue.fixVersions.get(1)}}
{{#if(name.match(".*Q.*"))}}
Needs Update
{{/}}
{{/triggerIssue.fixVersions.get(1)}}

{{^triggerIssue.fixVersions.get(1)}}
{{#triggerIssue.fixVersions.get(0)}}
{{#if(name.match(".*Q.*"))}}
{{name}}
{{/}}
{{/}}
{{/triggerIssue.fixVersions.get(1)}}



2 answers

0 votes
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.
August 6, 2025

Hi @Melissa C 

You are trying to perform two filters: find version names containing a "Q", and do something different when more than one is found.  I do not believe that can be done in a single step.

 

I recommend first parsing to get the ones with a "Q", storing the result in a variable:

  • action: create variable
    • name: varQuarterlyVersions
    • smart value:
{{#triggerIssue.fixVersions}}{{#if(name.contains("Q"))}}{{name}},{{/}}{{/}}

Then after removing any trailing comma, use the longer format of if() which supports true and false results.  Please note well this version of if() does not have a pound # sign.

{{if(varQuarterlyVersions.substringBeforeLast(",").contains(","), "Needs Attention", varQuarterlyVersions.substringBeforeLast(","))}}

 

Kind regards,
Bill

0 votes
Vitalii Rybka
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.
August 6, 2025

Hi @Melissa C,

You're on the right track! Here's a cleaner approach to detect multiple Q versions and set "Needs Attention":

Solution:

handlebars
{{#with(triggerIssue.fixVersions.where(name.contains("Q")))}}
  {{#if(size.gt(1))}}
    Needs Attention
  {{else}}
    {{#each(.)}}{{name}}{{/}}
  {{/}}
{{/with}}

How it works:

  1. where(name.contains("Q")) filters to only Q versions
  2. size.gt(1) checks if more than 1 Q version exists
  3. If true → outputs "Needs Attention"
  4. If false → outputs the single Q version name

Alternative approach with counter:

handlebars
{{#with(triggerIssue.fixVersions.where(name.contains("Q")).size)}}
  {{#if(gt(1))}}
    Needs Attention
  {{else}}
    {{#triggerIssue.fixVersions}}
      {{#if(name.contains("Q"))}}{{name}}{{/}}
    {{/triggerIssue.fixVersions}}
  {{/}}
{{/with}}

Test scenarios:

  • FixVersions: ["ProjectXYZ", "25-Q4"] → Output: "25-Q4"
  • FixVersions: ["25-Q4", "25-Q3"] → Output: "Needs Attention"
  • FixVersions: ["ProjectXYZ"] → Output: (empty)

The key is using where() to filter and size to count the filtered results.

Need help testing this or have questions about the syntax? Feel free to DM me!

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.
August 6, 2025

Hi @Vitalii Rybka 

What is the source of your information for this post?

There is no {{else}} expression in smart value, conditional expressions: https://confluence.atlassian.com/automation/jira-smart-values-conditional-logic-1081351607.html

 

And as a reminder, when posting bot / AI-generated content, that source should be disclosed in the text of a post.  For more information, please carefully review the community guidelines: https://community.atlassian.com/forums/custom/page/page-id/rules-of-engagement

 

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events