inherit custom field values from parent to subtasks


I created a custom field in Jira which is "Customer ID" and I would like if a parent task has this field, all subtask inherit the value of this custom field automatically and no one allowed to change custom field value of it in subtasks.

Could you please kindly tell me how can I do it ?

Best Regards,

4 answers

0 votes
Mahesh S Community Champion Sep 28, 2016

Introduce a 'scripted field' using script runner plugin. Hide it from the screens. Using the scripted field, update the custom field value in the subtasks.


Introduce a 'scripted field' using script runner plugin. Set it for the subtasks alone using field conf or screen or set field context. Get the custom field value form parent and just display in the subtasks. 



Hi Amir,

as Mahesh mention you can use Script runner addon.

  1. add 'Custom script post-function' to your workflow on Create transition
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.*;
import com.atlassian.jira.issue.util.IssueChangeHolder;
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder;
def IssueManager issueManager = ComponentAccessor.getIssueManager();
def CustomFieldManager customManager = ComponentAccessor.getCustomFieldManager();
def IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
//get and update value of my customField CRM ID
try {
    if (issue.getIssueType().isSubTask()) {
        def String crmID = issue.getParentObject().getCustomFieldValue(customManager.getCustomFieldObjectByName('CRM ID'));
  		customManager.getCustomFieldObjectByName('CRM ID').updateValue(null, issue, new ModifiedValue(null, crmID as Double), changeHolder);
} catch (Exception ex) {

2. move your post function till the end of list, at least after Issue Created.

3. publish your update workflow

Happy inheriting smile



Mahesh S Community Champion Sep 28, 2016

Hi Peter, my suggested solution is with scripted field and yours is with scripted post function. Glad to see your script here. However, once we add this scripted post function, subtask's custom field will get updated from the parent  when it make a transition.

But, how will the existing issues in different states will behave in this manner, when we do not make any state changes?

Existing issue will not be affected. You have to do one-time-update with another script...

Mahesh S Community Champion Sep 28, 2016

Exactly! But, I believe Amir needs it for all issues both newly creating ones and existing ones.

You can create a further custom field "Customer ID Sub" which should be configured only on the view screen of you sub task. (In the view screen it can be configured as read only).
Use the plugin Workflow Essentials and put the post function "Copy field value from parent to sub-task " into the create transition of you sub task. As soon the sub task is created the post function will copy the field from "Customer ID" to "Customer ID Sub". 

Mahesh S Community Champion Sep 28, 2016

True it works using the post function when we create or do a transition. But how will it update when you make changes in the parent dynamically and no state changes happen in subtasks?

The Field Teller plugin allows you to configure fields to be displayed in the subtask. No value copying is done and values cannot be changed from the subtask. It's not a free plugin, but it is not really expensive either.

Hope it helps.

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 ...

2,864 views 12 18
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