post function to set subtask fields from parent on create

I'm trying to do something that is well documented but for some reason it's not working for me....

I would like to default some custom fields when creating a subtask from the parent (from the JIRA UI) to values from the parent.

I have created the following post functions on the create issue transition. But the fields are not pre-populated with defaults from the parent when the 'create subtask' page is displayed.

  1. The value(s) of field Platform(s) will be set from the issue's parent (replacing existing values).
  2. The value(s) of field Application will be set from the issue's parent (replacing existing values).
  3. Creates the issue originally.
  4. Fire a Issue Created event that can be processed by the listeners.

What am I missing?

3 answers

1 accepted

This widget could not be displayed.

I thought that was the case but after reading this https://confluence.atlassian.com/display/JIRAKB/Post-Function+in+the+Create+Issue+Transition+does+not+Update+Assignee+due+to+Order?utm_source=SAC&utm_medium=dashboard it made me think that somehow it was executed before the create screen was displayed.

Is there any way to default a custom field on the subtask from the parent when the create screen is initially displayed? In fact, I really don't even want to show the custom field on the subtask but if I hide it I run into the problem in that the subtask rows are not returned in the JQL results.

Any help would be appreciated

Sorry for the late reply. I didn't recieve a mail about your answer. What you can do is to remove the fields from the subtask create screen. Use your postfunction as before. So once a subtask is created the fields are inherited from the parent. Don't hide the fields, simply don't put them on the view, create or edit screen of your subtask. You will be able to query them. Hope that helps.

That did the trick. Thanks very much! Note that I also opened this issue but I think that your solution may help others who want to set the field value on the subtask as opposed to providing a visible default. https://support.atlassian.com/servicedesk/customer/portal/23/JST-133222 thanks again Ron

This widget could not be displayed.

Well, the postfunctions will run only when you hit the create button on the create screen of your subtask. That's why the fields are not populated on the create screen.

This widget could not be displayed.
Andreas Knecht Community Champion Nov 21, 2016

There's now a very easy to configure way to keep fields for parents and sub-tasks in sync using Automation for JIRA!

You can easily modify related issues (such as parents, stories, sub-tasks, epics, linked issues and even JQL) using our related issues action and condition:

(this example updates the description, but pretty much any field can be edited including custom fields)

For more details see https://blog.codebarrel.io/synchronize-parent-and-sub-task-issues-with-automation-for-jira-bdcca6c9d453

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 5 hours ago in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

23 views 0 1
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