Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

JIRA JMWE Groovy - how to check the summary of linked tickets

I am working with JMWE and trying to write a groovy script where I want to check the summary of the linked tickets and if they do not contain the word 'auto' anywhere in the summary title... it will create a new ticket. I've tried many different combinations and haven't been able to get it to work. 

2 answers

1 accepted

0 votes
Answer accepted

Do you want to create one new issue per linked issue that doesn't contain the word "auto" in the summary, or do you want to create a single new issue if none of the linked issues contain "auto" in the summary? Derek's solution above answers the former - for the latter, you'll need to use the "Conditional execution" feature with this script:

!issue.getLinkedIssues().any { it.summary.toLowerCase().contains("auto") }

Also, that will check all linked issues, but not sub-tasks or issues in an Epic. So the code really depends on what you need. 

David, this is exactly what I was looking for! It is the latter. I also have another use case to look for any linked issues where the issue type is documentation. Is this correct? It seems to have worked after testing it.... 

!issue.getLinkedIssues().any {it.issueType.name == "Documentation"}

That will work. Or if you know the link direction name (as it appears on the issue), you can do:

! issue.getLinkedIssues("has documentation")

which will return true if the issue doesn't have any issue linked to it through the "has documentation" link type direction.

Hi @David Fischer _Appfire_ ,

Sorry to bother you,

How should I write the same code but for issue in Epic? I faced the same problem but my linked issues are under issue in Epic. Thank you very much!

Hi @Kris Han ,

it's actually documented in the Issue Methods help tab, but here it is:

issue.stories
0 votes
Derek Fields Community Leader Sep 08, 2020

You can use the JMWE Post-Function "Create / Clone Issue(s) Post-function". Check the box "Multiple Issue Creation" In the "Iterator" field, paste:

issue.getLinkedIssues().findAll { ! it.summary.toLowerCase().contains("auto") }

This will return a list of linked issues that do not contain the word "auto". This will then allow you create a new issue for each one that is returned in the iterator.  

Suggest an answer

Log in or Sign up to answer
TAGS

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