Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Moving data from one field to another

Sherry Nightingale
Contributor
August 19, 2024

Hi - I have two custom fields of the same name that are different field types

 

I want to move data from one field type to another field type

 

I'm assuming this can be done via an automation rule?

 

I have the two IDs

PO number 10274 multi line

PO Number 10539 single line

 

I want to move the data from 10274 to 10539

 

I'm new to automation rules - any help on what the rule should be would be greatly appreciated

 

Thanks

Sherry 

 

3 answers

1 accepted

0 votes
Answer accepted
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.
August 19, 2024

Hi Sherry,

I usually start by changing the name of the field I am getting rid of, to maybe add a period at the end or someway to differentiate between the fields. 

Then create a Schedule trigger rule - you can use whatever time period you like.  Then add a JQL for "old field name" is not empty where old field name is the exact new name of the field you might have change above. If you have multiple open tabs and you are switching between them, be sure to refresh the rules tab after the name change and before creating the rule. 

You might even want to have a JQL like field one is not empty and field two is empty. Do your JQL validation just to be sure. You also might want to create a JQL for just one issue (key = ABC-123) to test it out first. 

Then add an action for Edit Issue and select field two (the field you are keeping). Then click the 3 dots beside the box under the field name and select Copy. 

Then click on the result in the box and change the value for "Field to copy value from" to field one (the name change one). 

Click Close, then Next. 

Then Turn Rule on. I usually have it with a name like Bulk change. 

Then in the top right of the rule tabs on the rule, click the 3 dots menu and select Run rule.

This will copy over all of the values. 

Then be sure to turn the rule off so it won't keep running for every time period.

Then as you have additional future needs, update the fields, turn the rule back on and run it. Then turn the rule back off. 

 

Sherry Nightingale
Contributor
August 19, 2024

@John Funk 

Thanks for the information but I can't get it to work and I think this is because i'm trying to move data from a multi line text field to a single line text field?

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.
August 19, 2024

Yes, going in that direction will be a problem. You would need to clean your data up so that it only has one line of data in the multi-line field. And make sure it doesn't exceed the limit for short text field. 

Sherry Nightingale
Contributor
August 19, 2024

Thanks @John Funk 

The majority is only on one line and all data is within the 255 character limit - i'm assuming then that it isn't the different field type that is causing the problem?

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.
August 19, 2024

You can try it with just a single issue that you know is within the character limit and see if it barfs on it. Just use key=ABC-123 for the JQL in the scheduled trigger - of course with your issue key. 

Judit Gal
Contributor
August 20, 2024

Hi @John Funk , I am working with Sherry on this problem. This is working: {{issue.Description.split(" ").get(0)}}

The problem is the field name we want to copy from contains a space character "PO number". How can I modify the expression above changing "Description" to "PO number"?

 

Like Lucas Gagliano likes this
Judit Gal
Contributor
August 20, 2024

sorry, that works if the separator is a space character, we need a line break but "\n" doesn't work. So there is two problems with this approach.

Judit Gal
Contributor
August 20, 2024

right, I cracked it. it was that simple: {{issue.customfield_10274.split("\n").get(0)}}

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.
August 20, 2024

Very nice - glad you got this going. Yeah, you just need to change out the name of the field or use the customfield ID as you have. 

Judit Gal
Contributor
August 20, 2024

Out of interest, is it possible to use regex to change line breaks in the filed before copy (so we wouldn't need to manually edit those which used multiple lines)?

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.
August 20, 2024

Do you have a specific example?

Judit Gal
Contributor
August 20, 2024

For example we have a custom field which is Paragraph type (multiline) and we want to search and replace all line break to a comma. 

It is connected to the original question because the best would be if we could change the text to single line (by changing the line breaks) and then copy to the short text field. 

note: we want to decommission the multiline custom field.

so the automation steps would be:

1. remove line breaks

2. copy text to short text custom field

3. delete string from the multiline custom field

Like Romith Shankar likes this
Bill Sheboy
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.
August 20, 2024

Hi @Judit Gal 

There are at least two ways to do that:

For example: {{issue.description.replace("\n", ",")}}

Using one of these to replace newlines is helpful as the match() function struggles with those characters, and so the fix is to chain the functions.

 

Kind regards,
Bill

Like # people like this
Judit Gal
Contributor
August 21, 2024

Thank you @Bill Sheboy , I was on that path already but it took me a while to figure out why this {{issue.description.replaceAll("(\n)","; ")}} insert the "; " twice. It is so easy once you know :P the solution is

{{issue.description.replaceAll("(\n+)","; ")}}

(of course the change will be do in a custom field I just use the description for testing)

Thank you very much to all the help, I think we have all we need

 

Bets Regards,

Judit

 

Like # people like this
0 votes
Sherry Nightingale
Contributor
August 19, 2024

@John Funk 

Thanks for the information but I can't get it to work and I think the issue is because i'm moving from a multi line field type to a single line field type?

Thanks

Sherry 

 

0 votes
Lisa Forstberg
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.
August 19, 2024

Hi @Sherry Nightingale 

Ah, I have seen this need also. You want an automation to copy the available options in one custom field to another custom field right?

Mostly an automations actions is about updating/changing issues, not the underlying configuration. I would LOVE to have some of that though. I can't seem to find any actions that is about managing the configuration via automations.

Even if you try to hack it via one dummy issue with all values applied in your multi list and in a automation try to do copy value from one field to the other (with a smart value variable) it doesn't push in the values.  

Other solutions

  • I think Scriptrunner have a built-in script that copy field values from one field to another that may be what you are after. If you have scriptrunner :S
  • I know that the external import > csv import lets up update values to a custom field so that might be a workaround instead of copying and pasting manually.
  • Another solution when I see you are on Premium...why not use Assets to manage your PO's in one central location, with a lot more bells and whistles than a ordinary select list custom field?  With an asset custom field it is easy to change between it being  multi select or single select.

best of luck!

/L

Sherry Nightingale
Contributor
August 19, 2024

Thank you @Lisa Forstberg 

We do have scriptrunner but we're going to be getting rid of it soon - 99% of what we need can be achieved with automations that don't come with a cost

Regarding Assets - we moved to Cloud 8 months ago and there is a lot of legacy that i've inherited - Assets is in my backlog to look at but for now i'm spending time de-cluttering because there is a lot of mess

 

Like Lisa Forstberg likes this
Lisa Forstberg
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.
August 19, 2024

I see, and when I read about the  SR they also caveat for the multi to single problem. I think your best bet is to use the import csv workaround, especially if your list is long.

br

Lisa

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events