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.
×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
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.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have a specific example?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
best of luck!
/L
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.