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

Set summary field with substring of parent issue's summary

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.

 

Screen Shot 2021-07-12 at 1.56.35 PM.png

 

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?)

1 answer

1 accepted

0 votes
Answer accepted

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 

@David Fischer (Appfire) 

This works perfectly. Thank you!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

703 views 2 21
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