Automatic copy of custom field text (subtask to parent issue)

Adam Jacobson
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.
January 18, 2014

We have a process where users test against a subtask but the parent issue is used to generate some documentation.

We want to prevent users from Passing each subtask unless there is some text in a custom field on the parent issue. There can be more than one subtask in this process but only one subtask needs to provide the text to the parent issue.

I want to make it easy for users so instead of stopping users and making them go back to the parent issue to complete the field, here are the steps I think could work well:

  • User clicks Pass on the subtask and the transition screen opens
  • If there is already text in the parent instance of the custom field, display it in the subtask instance. User can Pass the subtask.
  • If there is no text in the parent instance of the custom field, disallow Passingof the issue until a minimum of 10 characters is entered in the custom field.
    • Copy the entered text back to the parent instance of the custom field.

My question is: where do I start?! Since I only do very basic code, I usually put these things together by hacking together some sample scripts but I've only found a one-way script that works in the parent > subtask direction. I'd greatly appreciate some pointers.

2 answers

0 votes
Henning Tietgens
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.
January 19, 2014

If you can live without the display of the parent value you can go with Bobs suggestion and than add a postfuntion which saves the entered value to the custom field of the parent issue.

Another way would be to spread the value from the parent issue to the childs with a listener (every time the parent custom field is changed write the value to all childs) and only test in the validator of Pass if the value has more than 10 characters.

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
January 19, 2014

There are probably a number of ways to do this. Here is one I know :).

You can add a Conditioned validator (Conditioned Workflow Functions for JIRA) to the transition that validates the the custom field has 10 characters or more. If not, the transition will be stopped and user can be given a detailed message (using Substitution variables like %parent_key%) to tell them exactly what they need to do allow the transition to proceed.

The condition regex you would need would look something like:

Condition value: %parent_mycustomfieldname%
Regex pattern: .{10,}

Justin Leader
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.
January 19, 2014

Great answers!

Suggest an answer

Log in or Sign up to answer