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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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
Answer accepted

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}}

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

Like Liam Harley likes this

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

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

Like Paul Benati likes this

Thanks for this answer as it worked like a champ for my use case!

Hi I am new to Jira automation and this forum.  So please forgive me.

re 

{{#issue.fields.subtasks}}{{fields.summary}} {{/issue.fields.subtasks}}

 

 Can you show how you have used this in an example please.   My first delve into adding Automation to our Jira is to have approval and estimation tickets created.    I am using the transition to review as trigger.   I wan to ensure that if the status is reset, that the tasks are not created again.    

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

421 views 3 18
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you