Forums

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

How can I filter issue type by smart value?

Casper
Contributor
September 20, 2023

This part of automation sends a comment when all Sub-Tasks are in status 'In Progress'
And notify everyone who is assigned to any sub-issue type of Parent Task:

Screenshot 2023-09-20 at 15.14.54.png

 

The same case here, but automation sends when all Sub-Bugs are in status 'In Progress'

Also tags everyone who is assigned to any sub-issue type of Parent Task:

Screenshot 2023-09-20 at 15.15.05.png

 

Here are all my sub-issues of Parent Task, Here you can see two Sub-issue Types:

- Sub-Task ( On top of the screen )

- Sub-Bug ( On bottom of the screen )

Screenshot 2023-09-20 at 15.14.18.png

Below is how automation sends the comment in two cases:

- All sub-tasks are 'In Progress'

- All sub-bugs are 'In Progress'

Screenshot 2023-09-20 at 15.15.41.png

As you can see automation tags everyone who has been assigned to some sub-issue of the parent task.

 

What do I need? 

- In case when all sub-tasks are in status 'In Progress'
I want to receive the same comment but with peoples who are assigned to all Sub-Task only, not from sub-bugs too.
( I mean do not recieve from all sub-issues of the parent task, only from sub-task )

- The same with second case, when all sub-bugs are In Progress,
I want to recieve a comment with everyone who are assigned to Sub-bugs only.

 

So how can I handdle ths case with Jira Smart Values or maybe some another solution.

 

2 answers

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.
September 20, 2023

Hi @Casper 

I believe you would need to do this in two steps, for each issue type involved: filter by type and then use distinct:

  • inside one of your conditions on type for the trigger issue, create a variable which filters by type and only save the assignees' accountId
    • name: varAssigneesForSubTasks
    • smart value:
      • {{#issue.subtasks}}{{#if(equals(issuetype.name,"Sub-Task"))}}{{assignee.accountId}}{{^last}},{{/}}{{/}}{{/}}
    • Please adjust the issue type name(s) to match your configuration
  • now to send the mentions, split the created variable back into a list, and use distinct on it
    • {{varAssigneesForSubTasks.split(",").distinct}}

Kind regards,
Bill

Casper
Contributor
September 20, 2023

@Bill Sheboy

Thank you a lot!

Did I do it well?

Screenshot 2023-09-20 at 16.50.29.png

Because i not sure i place variable in the right place.

All the best,
Ostap

Casper
Contributor
September 20, 2023

Also, I tried this case, and it doesn't work.

I'm sure I missed something.

Screenshot 2023-09-20 at 17.00.48.png

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.
September 20, 2023

Yes, the created variable needs to be inside the condition (and branch) to do this for each issue type case.

Sorry, I left off some details on doing the mentions...

This produces a list of accountId values:

{{varAssigneesForSubTasks.split(",").distinct}}

And that must still be parsed into mentions, like this:

{{#varAssigneesForSubTasks.split(",").distinct}}[~accountid:{{.}}]{{^last}}, {{/}}{{/}}

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.
September 20, 2023

Oops, my mistake!

The created variable expression was incorrect as I left off the assignee field!  I fixed the earlier post and here it is also:

{{#issue.subtasks}}{{#if(equals(issuetype.name,"Sub-Task"))}}{{assignee.accountId}}{{^last}},{{/}}{{/}}{{/}}

Casper
Contributor
September 20, 2023

@Bill Sheboy I fix that, but it still doesn't work.

Here is what Jira comments send:

Screenshot 2023-09-20 at 17.38.10.png

 

Also here are more details on how I use your solution: Link

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.
September 20, 2023

Would you please post images of:

  • your current, complete rule
  • the details of the create variable action(s)
  • the details of your use of that variable in the mention

 

And...did you confirm the exact names of your sub-task types?  If the names are not correct the created variable results will be empty.

You can confirm that by adding a write to the audit log immediately after the trigger:

the issue type's name is: {{triggerIssue.issuetype.name}}
Like Casper likes this
Casper
Contributor
September 20, 2023

True,

name was Sub-task, not a Sub-Task.

Sorry, I though that the upper letter didn't effect the result.

 

Thank you a lot Bill for your effort.

 

All the best,

Ostap

Like Bill Sheboy likes this
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.
September 20, 2023

Just to confirm, is the rule working now?

A work-around for that challenge with capitalization is to force the text to lower (or upper) case before the comparison/filter.  Although that is not always what is desired for matches.

Like Casper likes this
Casper
Contributor
September 20, 2023

Yes it works!

Like Bill Sheboy likes this
0 votes
Casper
Contributor
September 20, 2023

Sorry for my mistakes @Bill Sheboy , my head starts a little bit exploding)

 

The solution:

Screenshot 2023-09-20 at 17.36.28.png

 

The sub-tasks:

Screenshot 2023-09-20 at 17.38.16.png

 

The result:

Screenshot 2023-09-20 at 17.38.10.png

Did I miss something?

Suggest an answer

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

Atlassian Community Events