Hello,
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
Thanks,
Vital
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.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign 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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 { it.name == "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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Vital,
You can use the post-function named "Copy Value From Other Field" from the JIRA Suite Utilities plugin.
-- Arthur Gonçalves
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, but I can't copy text value (I have unnecessary text "some_text (06-Dec-2014)" other than the date) to date field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.