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

Chithra June 13, 2017

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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 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
TAGS
AUG Leaders

Atlassian Community Events