Post function copy field from parent not working when cloning sub-tasks

Hi,

We have several post-funtions in the sub-task workflow for the Create action that copy values from various fields in the parent issue.  This includes built-in fields such as Affects Version and Fix Version, plus some custom fields. This works fine when creating new sub-tasks.  However it is not working when we create a clone of a sub-task.  All the fields that should get populated are blank.

JIRA Server 6.1.7

 

Any help would be much appreciated.

Martin.

1 answer

you just have to be sure the changes to the parent issue are preserved (saved) first. put your post functions after the parent is indexed.....4th or 5th default post-function

Ok, guess I should have asked some more questions - first off, give me the usual suspects - JIRA version, JDK version, Script Runner version.

Ok, after asking the correct questions I define your problem as this:

With JIRA v6.1.7 you have subtasks (one or more of the subtask types) using a workflow which contains a post-function in the 'On Create' workflow that copies a value from the parent issue using the Suite Utilities 'Copy value from Other Field' selecting the parent issue as the source and the sub-task as the destination.

When creating a sub-task from the parent issue you see the subtask on-create post-function execute and the sub-task field is populated when the sub-task has been created.

When  you then go into that sub-task and select 'clone', creating a copy of the sub-task, the sub-task field is not populated from the parent issue (I'm guessing that you go in and modify the parent issue field and do not see the changed value in the 'cloned' subtask, cause otherwise it'd just have the same parent value that the first sub-task field had been assigned and you wouldn't know if it came from the parent via the post function or just from the sub-task as part of the clone activity).

Question - did you add the following additional post-function to your sub-task on-create workflow transition? Look at post function #3 immediately prior to #4 (duh) 'Re-index an issue to keep indexes in sync with the database' - see the post function 'Stores updates to an issue (no change history is created)'? Notice how in the screenshot the delete (and edit, though you can't see it) are not selectable? This is a post function that you can add but not remove. Do you have it in your sub-task 'On Create' workflow post-functions?

I had to add it to get any of the 'copy field' post functions to work in the 'on create' transition, but once I added it then fields would be copied on my sub-task regardless of whether I was creating the initial subtask or cloning one I'd already created.

Attachments - storeIssuePostFunction - adding to workflow

store_issuePostFuntion.png

 

subtaskCreateWorkflow.png

And Here I cannot remove it once added....you cannot tell, but the 'delete' and 'edit' options are not enabled.

postfunction-CannotRemoveStoreIssueFunction.png

-wc

Do you mean in the post-functions for the sub-task create action? This has the actions to copy the fields from the parent before the re-index. I understood this was required to get the sub-task index correct. I don't see a post-function to re-index the parent. Martin.

@Martin Burton - I edited my original answer asking how these sub-tasks are being created - is it via a post function in the parent issue's workflow? If so, is that post function being fired prior to the parent reindex post-function? If that is the case then just move your 'create sub-task' post function to after the parent is re-indexed. If not then please reply with more details on your setup - jira version, process description, etc thanks -wc

Hi William, We are just using the standard Clone option from the first sub-task to create additional ones. This is not part of the parent issue create or any other transition. As mentioned there are post-functions in the sub-task create that copies the field values from the parent. Creating the parent, first and subsequent sub-tasks are all separate operations. Details of our Jira instance are: JIRA Build : 6.1.7#6163-sha1:94d557d067e7b31a37a03eea89c85612ea7bb3b6 Build Date : Wed Jan 22 00:00:00 GMT 2014 JIRA Installation Type : Standalone Application Server : Apache Tomcat/7.0.29 - Servlet API 3.0 Java Version : 1.7.0_25 - Oracle Corporation Script Runner : com.onresolve.jira.groovy.groovyrunner Version : 2.1.16 Status : enabled Vendor : Jamie Echlin Ltd Description : Script runner plugin for Atlassian JIRA. Thanks for your help. Martin.

Martin, Ok - guess I should have asked this to start with - what is being used to copy the value from the parent issue? Is it a custom groovy function? Not the suite-utilities 'copy value from field' where you can specify the parent issue as the field source? -wc

William, We do use the Copy value from field post-function, with the parent specified as the field source.. Martin.

@Martin Burton - I updated my answer - did any of this help you at all?

Thanks William. I have added the Store issue post-function, and moved create issue to the top. Previously I had Create Issue after all the copy fields as my workaround to get the copies to occur. Now all the fields are populated. However some come from the parent and some from the sub-task being cloned. I need to check which it should be with the user team, and experiment with the order of the post-functions. Martin.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,313 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot