Copying Parent Summary to the Summary of a Cloned Subtask

Chris Stemen March 5, 2014

Hello. I am trying to solve a problem for one of my teams (documentation team) that gets tasks assigned to their board through the clone of a specific subtask on the dev team board ear-marked for their needs. If it matters, they work from two different projects as the docs team supports the entire organization and have their own set of prioritized issues outside the scope of the devs.

My solution up to this point is as follows:

1.) When an issue is created on the dev project, I have post-script functions that auto create a set of subtasks (i.e. fix it, test it, document it). These functions are on the "Open" step -> "Create" transition of my workflow.

2.) When the "Document It" subtask is moved to Done, I have another post-script function that clones the issue if it is of custom sub-task issue type (Documentation Subtask). There are a number of custom fields I show on the "Document It" subtask that I need completed and passed along to the docs team, and must be filled in by the Dev Team in order to meet their definition of done.

3.) The Clone step executes, and copies over relevant information, but the problem is the summary of the cloned item just says "Document It". Therefore, every time a team completes this subtask, it clones over, but when you look at the Doc team board, all issues read "Document It", which is not very helpful for them.

What I would like to do is copy over the original summary of the parent issue of the "Document It" subtask, as that is the relevant information for the team that will help them determine what they are working on (right now they have to traverse the links to get to it, which is annoying). I don't want to append the parent summary to the "Document It" subtask, as that clutters the dev subtasks on the work view.

I have searched through the boards and come across a number of solutions that are close, but haven't been able to quite get one that solves this specific issues.

https://answers.atlassian.com/questions/167010/how-to-set-the-summary-of-an-issue-with-groovy-script-at-create-transition<br< a="">>
https://answers.atlassian.com/questions/147492/how-to-copy-parent-ticket-summary-to-sub-task-summary-by-script

I have tried adding to "Additional Issue Actions":

issue.summary = issue.parent.summary
- not sure if the parent issue is available at this step in the execution

issue.setSummary(issueLinkManager.getInwardLinks(issue.getId())*.getSourceObject().summary)
- guessing the link hasn't been created yet for this function to work as I can get this to test out successfully in the condition tester, but of course the clone already exists.

issue.summary = transientVars["originalissueobject"].summary
- returns subtask issue summary, rather than parent

Has anyone tried doing something similar? I have script runner and jira suite utilities plugins installed/enabled.

Thank you in advance.

Chris

4 answers

1 accepted

0 votes
Answer accepted
Chris Stemen March 17, 2014

It seems I am going to end up writing a custom script to get this accomplished.

Dotun O April 29, 2014

Hi Chris, were you able to solve the problem? I'm trying to copy a parent summary to a subtask summary during the create issue transition. I'm not familiar with groovy scripting but I'd still appreciate if you could share your script with me.

Chris Stemen April 30, 2014

If you are just looking to copy the parent summary value directly to a subtask when it gets created, all you need to do is leave the subtask summary field blank when setting up the subtask creation workflow post script function. Below the subtask summary field it says:

Optionally set the summary. If blank it will be inherited from the parent.

Does this solve your issue?

Dotun O April 30, 2014

I'm not using the subtask creation postfunction. I'm manually creating the subtasks. But I used the following workaround to copy the summary. I filled the subtask summary with a dummy string (by adding some java script to the description). I created a "temp" status between "create" and "open", and then I used the script function to auto-transition the issue while copying the parent's summary (with miscellaneous workflow extensions) and overwriting the dummy string.

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 1, 2014

Should be

transientVars["issue"].summary

0 votes
Chris Stemen March 6, 2014

Hi Jamie. Thank you for the quick response. Could you specify where the capitalization error is? I am using the "issue.summary = transientVars["originalissueobject"].summary" statement from an example on the web. I have run this last post script with logging on and will check to see what comes up.

Chris

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2014

issue.summary = transientVars["originalissueobject"].summary

is that a typo? The capitalisation is wrong. IIRC the answer is transientVars... if you "log.warn(transientVars)" and check your log file, one of the things in that map gives you the parent ID or similar.

Better still debug in an IDE.

Suggest an answer

Log in or Sign up to answer