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.
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"}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @David Fischer ,
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.