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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

796 views 2 19
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