Create Issues from checkboxes using JIRA Automation

Randy Elias January 23, 2024

Hi All,

   Is there a way to use JIRA automation to create multiple JIRA issues based on items checked off on a checkboxes custom field?

ie) Task-Checkbox (custom field)

      ☑ Task 1

      ☐ Task 2

      ☑ Task 3

      ☐ Task 4

  In the above example, I need to use automation to create 2 JIRA tasks. One for Task 1 and one for Task 3. Is this possible?

I'd like to create the JIRA issues upon the checkboxes custom field being updated or created for the first time. Thanks!

2 answers

0 votes
Randy Elias January 23, 2024

I was able to get my JIRA Automation to work, but there is a scenario that causes errors.

Here is the logic at a high-level:

Screenshot 2024-01-23 at 2.15.55 PM.png

I use Advanced Branching to iterate through the Checkbox list of items and create a new JIRA Task for each item that is checked. 

The problem is when I go back to the checkbox and check off another item. The JIRA automation will create the new Task but also create tasks for the items already checked. 

 ie) Marketing Activities (Checkbox custom field)

      ☑ Task 1

      ☐ Task 2

      ☑ Task 3

      ☐ Task 4

     The first time the automation runs, it creates JIRA Tasks for Task 1 and Task 3.
     Now I check Task 4 so the following are now checked:

     Marketing Activities (Checkbox custom field)

      ☑ Task 1

      ☐ Task 2

      ☑ Task 3

      ☑ Task 4

 

     I want the JIRA automation to create a new JIRA Task for only Task 4, but instead 3 new JIRA Tasks are created (Task 1, Task 3 and Task 4).

 

     Any way to get around the duplication of Tasks in this scenario? Thanks!

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.
January 23, 2024

Hi @Randy Elias 

A couple of things to try to prevent the duplication are the use of the change log (i.e., fieldChange) or condition checks:

 

Try using the Change log

The {{fieldChange}} smart value has some extra attributes which might detect the added / removed values from the checkbox, as the selected values are essentially a list: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--

Unfortunately there are known problems with the accuracy of the fieldChange smart value for some list fields.  I recommend testing this first: create a test rule, triggered on changes to your field, and write the smart value for the changed values to the audit log.  If it works as expected then use those to decide which tasks to create.

If that does not work...

 

Try using Conditions

When changing the checkbox field, the rule could trigger several times in rapid succession, as values are added / removed.  And rule branches which could be on more than one thing are executed in parallel and asynchronously, with no guarantee of when the branch will finish...up until the last step of the rule.

Those two things together could definitely create timing errors in your rule, leading to problems with both the creation and detection of issues.  You could try to remove the branch and try this:

  • trigger: your field is updated
  • action: re-fetch issue (This will slow down the rule by reloading the data before proceeding.)
  • branch: to current issue
    • condition: check if the value of Task 1 is selected in your field
    • action: lookup issues with JQL to find any possible Task 1
    • advanced compare condition: check that the Task 1 was not found
      • first value: {{lookupIssues.size|0}}
      • condition: equals
      • second value: 0
    • action: create Task 1
  • ...repeat the branch, testing for Task 2 - 4

This is a much slower (and longer) rule, but the slow downs may help to prevent the duplication.

Kind regards,
Bill

Like Randy Elias likes this
Randy Elias January 24, 2024

Thanks @Bill Sheboy

I've almost got this working using your algorithm. 

Do you know how I can reference each item in the Checkbox array?

I was thinking the syntax would be something like:

{{issue.Marketing Activities[i].value}} where i = 0 to 3 in my example above. 

 

But this doesn't work. 

Randy Elias January 24, 2024

Nevermind. That syntax is:

{{issue.Marketing Activities.get(0).value}} for the first item.

Like Bill Sheboy likes this
Randy Elias January 24, 2024

@Bill Sheboy - Thanks again! I got the automation working correctly using your "Conditions" algorithm. 

0 votes
Wojciech Wardaszko [HeroCoders]
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.
January 23, 2024

Hi @Randy Elias

Welcome to the Community!

The answer to your question heavily depends on what Checklist app you have installed in your Jira.

Checklists are not supported in Jira natively, so I'm guessing you have to be using one of the checklist apps available on the Marketplace.

Let me know which one is it and I'll try to guide you in the right direction.

Cheers!

Randy Elias January 23, 2024

Thanks for the prompt response @Wojciech Wardaszko [HeroCoders] !

Actually, I should have titled the post "Create Issues from Checkbox using JIRA Automation".

I believe I'm using the native "Checkboxes" custom field type.

Wojciech Wardaszko [HeroCoders]
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.
January 24, 2024

Oh, I get it now.

As a worker of a company that made checklist apps I immediately jumped to conclusions, my bad. I think @Bill Sheboy answers will put you on the right track if you want to stick to just custom fields.

Having said that, I do strongly recommend using our Issue Checklist Free for this - it usually brings a lot of value to cases where there are things to marked as done and processed.

It comes with a built-in feature to convert an item to a task ;)

It's also possible to use our app with automation rules and the possibilities are nearly endless.

Let me know if you'd like to know more :)

Cheers,
Wojciech

Suggest an answer

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

Atlassian Community Events