Forums

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

Is it possible to append values from multiple fields to one field?

janez_m
Contributor
July 13, 2023

We are trying to consolidate and simplify custom fields in use and one idea is to copy values from five different custom fields into one new custom field with all the same values as the old fields.

I wanted to use Scriptrunners copy-field feature, but it is not appending values and in the documentation they mention "If the target field already contains values, they are overwritten by any copied values."

Some other folks here mention JSU, but that is a workflow automation and I don't see how it could help here.

Is there some way to achieve this? I recon the only way to do it is to write a complex GROOVY script?

1 answer

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 13, 2023

Hi Janez,

I don't use ScriptRunner, but using Automation for Jira you would use:

{{issue.description}} {{issue.field 1}} {{issue.field 2}} 

So for the Description field,  the first part would keep the existing value of the field and then the next two would be whatever the actual field names are of the other fields. Not sure if they puts you on the right path for ScriptRunner or not. 

janez_m
Contributor
July 17, 2023

Thank you @John Funk, I like your suggestion and I did check out Automation for Jira if I can append the fields with it, but I was unsuccessful.

I tried this two approaches:

  • When: Manually triggered

  • For Current issue
  • If: Issue matches JQL
  • Then: Edit issue fields

 

  • For Current issue
  • If: Issue matches JQL
  • Then: Edit issue fields

 

  • For Current issue
  • If: Issue matches JQL
  • Then: Edit issue fields

But this rule overwrote the values and did not append them even though I selected the "Add to existing values" when configuring the Edit issue action.

Then I tried with a script to copy the values instead of "Edit issue fields" as Automation for Jira has an option "Execute a ScriptRunner script" and used a simple script which failed on execution - probably the script was totally wrong (I have deleted it from automation so I can't post it here).

I will try to find/make a better script to use and try again.

But I would like to ask you what you meant with the smart-values you pointed me to:

{{issue.description}} {{issue.field 1}} {{issue.field 2}}

I tried to find an action in Automation for Jira where I could use your suggestion but I do not know which action could I use?

Appreciate your help,

Have a nice day,

Janez

Like John Funk likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 17, 2023

Can you share the actual rule that you created?

Like janez_m likes this
janez_m
Contributor
July 18, 2023

Hey, yes I can, it is simple like this:

 

Screenshot 2023-07-18 at 13.46.30.png

The edit issue action looks like this:

Screenshot 2023-07-18 at 13.47.21.png

Maybe the issue is that I am copying from a checkbox field into a Select List (multiple choices)?

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 20, 2023

That's probably it with the different field types. 

However, you might take a look at this previous post about Components - not the same field but would behave the same way I think. 

https://community.atlassian.com/t5/Jira-Software-questions/In-Jira-Automation-how-do-I-add-to-a-component-and-not-clear-the/qaq-p/2194124

janez_m
Contributor
July 20, 2023

Thank you @John Funk that is quite an interesting functionality I did not know it existed in Jira, but unfortunately we are not using the cloud Jira, but the server one, so I don't have access to creating custom variables.

 

I will try to make a workaround then with additional custom fields that will act like the custom variables buffer so I can get the values out of checkbox fields and into the select list - and then try to append them all to the final field I am trying to fill.

 

Have a good day!

Like John Funk likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 20, 2023

Ah, sorry! Forgot you were using Server. Good luck with the workaround!

Like janez_m likes this
Joe Red
Contributor
October 3, 2024

@janez_m  Any luck on your solution.

I have 2 fields that the spelling if off on one, but users have been using both fields.... I need to merge one into the other WITHOUT overriding like ScriptRunner does.

I am using Jira Data Center not Cloud.

Janez Moličnik October 6, 2024

@Joe Red No we did not find a solution in Jira, so we changed the process and made some changes to fields in question.

 

If you have issue only with spelling, can't you correct that in values of the custom field?

Suggest an answer

Log in or Sign up to answer