It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Copy from text field to date field


I need to copy value from Select list field to Date field. Select list has values like "some_text (06-Dec-2014)". I need to do it in post function

My JIRA version is 4.4.4



3 answers

Update on Transition for JIRA has Update issues post function. You will need use the findReplace substitution variable to get the date text out of the string. That can also be used to make sure the date gets specified in the correct format expected by JIRA for setting the date field. 

0 votes

Hello Vital,

You can use the post-function named "Copy Value From Other Field" from the JIRA Suite Utilities plugin. smile

-- Arthur Gonçalves

Sorry, but I can't copy text value (I have unnecessary text "some_text (06-Dec-2014)" other than the date) to date field.

0 votes

You can't copy, the data structures are not the same, but that's not a big hurdle, you can parse it.

What are you planning to write this function in?

Hey @Nic Brough {Adaptavist} ,

Can we parse it using scriptrunner? Do you have an example? To copy from a text field to date field (assuming the text field already in dd/mm/yyyy HH:MM:SS AM/PM format - old admin seems to be passing this date value to jira from API, instead of using date field, he utilized text, so we're cleaning things up). Thanks in advance!

Yes, SR can be used to read a field and parse it.

If your text is consistent, it should be quite easy to do.  From memory

import java.text.SimpleDateFormat
import java.util.Date
def oldDateField = customFieldManager.getCustomFieldObjects(issue).find { == "My old date string field" }
Date newDate = new SimpleDateFormat("dd/mm/yyyy HH:MM:SS a").parse(issue.getCustomfieldValue(oldDateField))

Note that I might be missing imports, you'll need to amend field names etc, I've assumed it's in a post-function or something else that has access to the issue object, and my date formatting string may well be wrong.  (My memory is not great at this)

Like Azfar Masut likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

342 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you