Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×

Forums

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

Checklist that generates subtasks

Jonathan Chatwin June 25, 2019

Hello,

In Jira Server I'm trying to create with the following 3 apps: Checklist, Automation and JMWE, a checklist that appears on a transition screen and based on which checklist (or jira base checkbox custom field) items are checked, create corresponding subtasks for each checkbox checked. 

So transition screen -> Checklist -> Based on items checked -> Create new subtasks with description set from issue being transitioned. 3 items checked = 3 subtasks

Don't have scriptrunner but have the 3 addons above. 

Any thoughts? 

 

Added the comment below: 

So in the transition I'm using the validator for Checklist to see if checklist items >= 1. Then in the post funciton I am using the Create/Clone JMWE function. I am then selecting the caluclated create issue. Inside of that I'm looking at the ChecklistItem Interface and wondering how to iterate over the checklist and for each option then creating a subtask for each of the 10 options in the checklist. 

 

4 answers

1 accepted

1 vote
Answer accepted
Deleted user June 25, 2019

Hi Jonathan,

 

Developer from Automation for Jira here.

Since you mentioned the field mapping to a "jira base checkbox custom field" you can use the guide above, alternatively you could also use our JQL condition to perform any check you can write with JQL.

It's possible to achieve this functionality by using 3 seperate if/else blocks which each check if your checkbox contains one of the checked fields. We have a new issue condition field which makes this easier with select fields/checkboxes, which you can see in my screenshots below. Your rule would be something like this:

  • Trigger: Issue transitioned
  • If/else block
    • Issue condition: (You could alternatively use our JQL condition that looks for the selected checkbox field)
      • Field: Your condition field
      • Condition: Contains
      • Value to compare: First field selection
    • Create sub-task
      • Add your sub-task and you can access fields from the issue using one of our smart values e.g. {{triggerIssue.description}}
      • Clicking on add fields will let you set multiple issue condition fields
  • if/else block
    • Same as the above with Second field selection value
  • if/else block
    • Same as the above with Third field selection value

If you would like more help on getting this use-case working, you can contact our support here: https://codebarrel.atlassian.net/servicedesk/customer/portal/1. Or find more information in our docs here: https://docs.automationforjira.com.

Overview:

rule-list.png

Condition:

condition-checkbox.png

Create sub-task:


create-subtask.png

 

Jonathan Chatwin June 27, 2019

This is great. Thanks, Much easier than I thought it would be. It was same as above but with creating a new issue in a separate project. I ended up doing it from a workflow global transition so that the transition screen would show. I coudn't get a transition screen to appear from a manual trigger. 

Automation for Jira is amazing, coming from using ScriptRunner for everything before (at a different company) I'm finding Automation is just as powerful in most cases without all the groovy... Also the audit log and alerts for logging too are just awesome. You guys have the best support. Just so impressed. Thanks again. 

2 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 25, 2019

Hi Jonathan,

the way the Checklist app works is a little unusual. When you use issue.get("checklist field"), it returns a list of all options, not just those that are currently checked like a standard Checkboxes custom field would. So you need to filter the results to just the checked items:

issue.get("checklist field").findAll {it.checked}

This will be your "Iterator script". Then, the "it" iteration variable will contain a com.okapya.jira.customfields.ChecklistItem, the interface of which is actually accessible from the "Interfaces" help tab of JMWE. But in a nutshell, the property you're probably interested in is "name" which returns the name (value) of the checked item. For example, to include the selected item's name in the summary, you could do:

${issue.summary} - ${it.name}
Jonathan Chatwin June 27, 2019

Thanks David for the help. Much appreicated. 

1 vote
Yves Riel _Okapya_
Atlassian Partner
June 25, 2019

Hi Jonathan,

Checklist for Jira here. When you say:

ChecklistItem Interface and wondering how to iterate over the checklist

Do you have access to the custom field value? If so you can iterate over it as it's simply an array. I know that it's doable with ScriptRunner but you said that you don't have that.

Jonathan Chatwin June 25, 2019

I was thinking of using the groovy interface in JMWE to access it... 

Yves Riel _Okapya_
Atlassian Partner
June 25, 2019

Hi Jonathan,

David has described what needs to be done when you get a hold of the custom field value.

Like Jonathan Chatwin likes this
0 votes
Jonathan Chatwin June 25, 2019

So in the transition I'm using the validator for Checklist to see if checklist items >= 1. Then in the post funciton I am using the Create/Clone JMWE function. I am then selecting the caluclated create issue. Inside of that I'm looking at the ChecklistItem Interface and wondering how to iterate over the checklist and for each option then creating a subtask for each of the 10 options in the checklist. 

Suggest an answer

Log in or Sign up to answer