Hi all,
I'm currently working on a JMWE post-function to auto-populate child issues upon creating an epic. I have a text template pre-populated from a scriptrunner behavior in the summary field of the epic that reads "[Property Name] - Checklist". The user is to fill out the property name in the brackets, fill out the rest of the form and create the epic. For the child issues created in the post-functions, I want the "[Property Name]" substring of the epic's summary to populate to the child issues' summary so that it would set to "[Property Name] - Team Information"..and the next child issue's summary would be "[Property Name] - System Overview", and so on.
I know I could easily reference the entire summary and copy that over to the child issue summaries like "[Property Name] - Checklist - Team Information" and "[Property Name] - Checklist - System Overview"...but if I can, I would want to avoid concatenating the Checklist part of the parent's summary, if at all possible.
So I thought setting the summary to a groovy constant like ${issue.summary.substringBefore("-")} - Team Information would work..but unfortunately it doesn't. if I can't reference that substring method to concat part of the parent's summary, is there another way to do it? (Or did I do it incorrectly?)
Hi @Ian Balas ,
the problem is, there is no such thing as a substringBefore() method on String objects, neither in Java nor Groovy.
There are plenty of alternatives though. The simplest is:
issue.summary.split("-")[0]
Best,
David
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.