Filter subtasks in automation

Ofir Haun
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 10, 2024

While constricting an automated email, pertaining to an Epic, i am using the following to list all the sub tasks in the Epic to be part of the email being sent:

  {{#subtasks}}
<a href={{url}}>{{key}}</a> - {{summary}} - {{url}} - {{assignee.displayName}} 
   {{/}}

this is working well, and the email include all of the subtask in a list.

now, what I like to do is to only add sub tasks which has a certain value as part of the sub task description.

have tried things like:

  {{#subtasks}}

  {{#if {{summary}}.contains("text")}}

           <a href={{url}}>{{key}}</a> - {{summary}} - {{url}} - {{assignee.displayName}}

      {{/}}

   {{/}}

 

but that does not work.

any ideas?

1 answer

1 accepted

2 votes
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.
May 10, 2024

Hi @Ofir Haun -- Welcome to the Atlassian Community!

You could use the indexOf() function to find the position of the text in the Summary.  If it is not found, the value will be -1, and so that may be used for a comparison.  Please adjust the example below for your scenario / specifics:

{{#issue.subtasks}}
{{#if(summary.indexOf("some text").gt(-1))}}{{key}}{{/}}
{{/}}

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#indexOf-String-str-

Kind regards,
Bill

Ofir Haun
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 10, 2024

Works like a charm!!

thank you Bill!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer