Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Copy custom field values into another custom field

Fariz Aliverdiyev
Contributor
May 23, 2022

Good day everyone. 

There is a sub-task workflow, which consists of two statuses: Review and Approved. When moving to Approved from Review user should fill Decision field on a transition screen. For example, number of sub-tasks is 7. All of them have their Decision field values.

So, the question is how can I copy all these Decision field's values from different subtasks into a single custom field, let's say, Overall Decision, in parent task? 

Thank you in advance.

3 answers

1 accepted

0 votes
Answer accepted
Fariz Aliverdiyev
Contributor
May 23, 2022

Hi @Marco Brundel , @Fadoua , 

Thank you for answers. There is a Scriptrunner plugin in the system, but no Automation for Jira Pro version.  

I recreated the rule @Marco Brundel shared, but on Automation Rules (JWT) plugin:

Screenshot_13.png

It works, but there is a problem. When the descision of the first sub-task "marketing approve' is edited to "marketing approve 1", the rule doesn't edit it on the parent task, it just adds it as a new decision. Example screenshot:

Screenshot_14.png

Is there is a way to avoid it? 

Thank you in advance.

Sergio García-Consuegra _Decadis AG_
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.
May 24, 2022

Hi @Fariz Aliverdiyev ,

Could you please give me more details about your requirement?

  • What is the type of the custom field "Decision" ?
  • Can different sub-tasks have the same decision? For example, let's say that the second sub-task and the fourth sub-task contain exactly the same decision. Is this possible? Or all of your sub-tasks will contain different decisions.

The following expression should work for your "Update field" action if your sub-tasks are going to have different decisions without being repeated, but if it's not the case, please let us know:

previousValue(%{trigger.issue.cf16147}) NOT IN %{selector.issue.cf16147} ? %{selector.issue.cf16147} + " " + %{trigger.issue.cf16147} : findReplaceFirst(%{selector.issue.cf16147}, previousValue(%{trigger.issue.cf16147}), %{trigger.issue.cf16147})

In order to make this expression work, be sure you selected "Advanced text" mode as parsing mode:

AdvParsingMode.png

Hope to hear from you soon!


Best regards,
Sergio

Fariz Aliverdiyev
Contributor
May 24, 2022

Hi @Sergio García-Consuegra _Decadis AG_ 

Thanks, it worked! But, yes, the field can contain same decisions, something like "ok" or "approved" and etc. Decision field is a multi-line text. Also, is it possible to add each decision on another line, not on a single line, as on my screenshot above? 

Screenshot_15.png

Sergio García-Consuegra _Decadis AG_
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.
May 24, 2022

Hi @Fariz Aliverdiyev ,

For this specific case, I would suggest an easier and more powerful solution, using our Calculated text fields.

  1. Create a new custom field, and the type must be Calculated Text Field (by JWT)
  2. Once it's created, configure it and add the following expression for this calculated text field (be sure the parsing mode is "Advanced text"):
    toString(textOnIssueList(subtasks(), ^%{issue.cf16147}), "<br>")
  3. Once it's created, just navigate to your parent issue and you will see that all the decisions from your sub-tasks are displayed with a break line. This calculated field is always automatically re-calculated, so you won't need to use that Automation Rule anymore.

Please, let us know if this solution worked as expected.

Best regards,
Sergio

Like Fariz Aliverdiyev likes this
Fariz Aliverdiyev
Contributor
May 24, 2022

Hi @Sergio García-Consuegra _Decadis AG_ , 

Thank you a lot, it worked!

Sergio García-Consuegra _Decadis AG_
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.
May 24, 2022

Hi @Fariz Aliverdiyev ,

I'm glad to hear the proposed solution worked!

If you have any other doubt related to our plugin, you can always contact us through our official support portal for customers

We will gladly help you :)

Have a good day!

Best regards,
Sergio

Like Fariz Aliverdiyev likes this
2 votes
Fadoua
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 23, 2022

@Fariz Aliverdiyev  that can be done using a plugin. Either Automation for Jira as mentioned by @Marco Brundel or ScriptRunner for Jira.

Jira out of the box doesn't offer this feature.

Best of luck

Fadoua

0 votes
Marco Brundel
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.
May 23, 2022

Hi @Fariz Aliverdiyev ,

 

I think it is possible with an automation rule.

Acceptance Criteria (customfield_13508) I used as a field in this example

In the edit-issue action I have
{{issue.customfield_13508}} - {{triggerissue.customfield_13508}}
put in the field.
This saves the value that was already in the field.

See this screenprint 
Screenshot 2022-05-23 at 15.54.00.png

regards, Marco 

Fadoua
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 23, 2022

Only if the user has the plugin. 

Like Marco Brundel likes this

Suggest an answer

Log in or Sign up to answer