Show parent task's fields in the sub task create screen

I know there are ways we can "copy" the parent task's fields in the sub task. But my requirement is quiet different. I want to show the parent task's fields (in editable mode) in the sub task's create screen, so that users who wish to change the values can change, simply create with same values otherwise.

Please suggest a way to acheive this. I have Jira Misc add-on and scriptrunner installed in my Jira server.

1 comment

Tarun Sapra Community Champion Jun 13, 2017

Hi Chithra,

You can add the field on the sub-task create screen, and mention in the description of the field that it will "override" the parent task's field value other it will copy the field value from the parent. And if the user fills in some value in this field then just use the script runner in the pot funtion to update the parent issue with the new field value.

The issue object as the method - getParentObject()

Once you have the parent issue object then you can call the method - updateValue on the custom field object to update parent's field value -

https://developer.atlassian.com/static/javadoc/jira/latest/reference/com/atlassian/jira/issue/fields/OrderableField.html#updateValue(com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem, com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.ModifiedValue, com.atlassian.jira.issue.util.IssueChangeHolder)

And if it's a system field and not a custom field which you wish to update on the parent then it's even easier as MutableIssue class has all the setters -

https://developer.atlassian.com/static/javadoc/jira/latest/reference/com/atlassian/jira/issue/MutableIssue.html 

Comment

Log in or Sign up to comment
Community showcase
Posted Tuesday 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...

174 views 1 3
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