Can I check if a certain sub-task exists yet using Automation for JIRA?

Andreas Knecht Community Champion Sep 20, 2016

I want to write an Automation rule that only adds sub-tasks if that sub-task doesn't exist yet on an issue.  Is this possible with Automation for JIRA?

1 answer

1 accepted

1 vote
Accepted answer
Andreas Knecht Community Champion Sep 20, 2016

Once again the compare condition (see all our rule components) can help here with smart-values:

Project automation - Code Barrel JIRA 2016-09-21 10-16-13.png

So this rule uses the compare condition to create a string out of all existing subtask summaries. If no subtasks exist yet, then it will simply be the empty string. However otherwise it will concatenate all existing subtask summaries separated by a space character.  We then check using a regular expression if this string contains the subtask summary of the new subtask we want to create yet ("my awesome subtask") in this case.

Only if the existing subtask summaries don't match this string yet (i.e. it doesn't exist), will the rule continue and create our 1 sub-task with the summary "my awesome subtask".

The extra space inside this smart-value completion is important (it separates the subtask summaries by a space if there's multiple subtasks):

{{#issue.fields.subtasks}}{{fields.summary}} {{/issue.fields.subtasks}}
Andreas Knecht Community Champion Sep 20, 2016

You can also compare other sub-task attributes, by using something other than fields.summary in the example above. For example: fields.priority.name

Isaac Garcia I'm New Here Tuesday

How can I check if an issue already exists in an epic?

Isaac Garcia I'm New Here Tuesday

This works if the trigger issue is not an epic and has an epic link.existsInEpic.PNG

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,128 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you