Example of how to copy a field value from parent to child using JQL

Nannette Mori
Contributor
June 22, 2020

Could you provide an example of how I can copy a field value from the Parent Issue to the linked Child Issue using JQL in the copy post function.

 

Thank You!

2 answers

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2020

Hello @Nannette Mori ,

Yes, you can copy a value from parent to child. Do you mean that you want to copy the value of a custom field from task to subtask? If so, then you could write a code like this:

#{your custom field name} = parent.#{your custom field name}

If you want to take a linked issue then use the allLinkedIssues method to get issues and then copy values. For example, like this:

for k in allLinkedIssues(key) {

  #{your custom field name} = k.#{your custom field name}

}

0 votes
mfabris
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 25, 2020

Hello Nannette

 

JQL is just a query language; it will not do anything to your tickets; it will just provide you lists of tickets, depending on your search criteria.

To copy a custom field value from parent to child in a post function you will need a Jira plugin; this operation is in facts not possible with just the out-of-the-box software.

There are several plugins that can help you with this. Maybe you already have one of them installed in your Jira. 

Nannette Mori
Contributor
July 20, 2020

Can I do the copy using Power Scripts, we do not have script runner

Suggest an answer

Log in or Sign up to answer