Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Automatically creating Subtasks from a Checkboxes field

Edited
Johannes Mayr
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!
Oct 25, 2023

I have a custom Field of type "Checkboxes". There I can select multiple Items from a list (predesigned steps that need to be done. E.g. Step1, Step2, Step3). When I add a new item to the checkbox, I would like to have an automation rule that automatically adds a Subtask for every selected step with the description "Conduct Step1".

I created an automation Rule that checks the custom Filed for values to be added.

With {{fieldChange.toString}} I get a String of all currently selected boxes. 

Now I have to problems:

* How to seperate this list and create multiple subtasks --> currently it creates one subtask with the whole list a s a string

* How to check that the subtask does not already exist and a duplicate is created

 

jira.PNG

1 answer

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.
Oct 25, 2023

Hi @Johannes Mayr -- Welcome to the Atlassian Community!

You could use an Advanced Branch, over the selected values of your checkbox field, and add a subtask for each one.

Please look here to learn about using Advanced Branches: https://community.atlassian.com/t5/Automation-articles/Branching-over-smart-values-in-Jira-Automation/ba-p/1741935

Also note that this type of branch executes in parallel for performance reasons, and so there is no guarantee of the order your subtasks will be created.

 

Regarding your question about preventing duplicates...That is a bit more complicated.

You could use Lookup Issues to first gather the current subtasks.  And then inside of the branch, use a condition to confirm the subtask does not exist before creating it.  Or you could just check the {{triggerIssue.subtasks.summary}} values, as that is already loaded.

 

And so an outline of your rule could be...

  • trigger: your checkbox field value changes
  • condition: issue type is what you expect (I recommend adding this condition.)
  • advanced branch: on the values of your checkbox field
    • action: lookup issues with JQL of parent = {{triggerIssue.key}} and summary = your branch variable
    • advanced compare condition: only proceed if {{lookupIssues.size|0}} equals 0
    • action: create the subtask

Kind regards,
Bill

Johannes Mayr
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!
Oct 30, 2023

Hi Bill,

thanks for your reply. I currently try to implement a simplified version that does not yet check for dublicates, but I'm struggling with the advanced branching function.

As suggested by the "When: Value changes for" block I used {{fieldChange.toString}} to get a list of the changed values of the checkbox.

jira2.PNG

Then I assign Summary field with {{WorkProduct}} in the "Then: Create a new" block.

This works so far, but I do only get one new subtask that has the whole list of selected items in the summary. So the "loop" does not work and is only executed once.

How to manage that my list is correctly iterated in the list?

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.
Oct 30, 2023

The {{fieldChange.toString}} smart value will just be text, and not a list of values.

Your two options are to use the split() function on any commas or to specifically use one of these smart values:

{{addedFieldChange.valueIds}} or {{addedFieldChange.values}}

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--

The specifics will depend upon how you are trying to use those in the create issue action.

Suggest an answer

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

Atlassian Community Events