I would like some assistance with scriptrunner - I want to return the Due Date value in a preferred format as currently with Dataplane reports the date format (as displayed) is not ideal.
Currently in Dataplane the Due Date value is displayed as YYYY/MM/DD however several teams want this to be displayed as DD/MM/YYYY instead (like it is in Jira). Dataplane vendor (Arsenale) advised their addon doesn't currently support changing this but suggested a scripted field maybe able to do it.
Essentially I want to create a scripted field that returns the due date value of the issue in my preferred format. I have had a poke around the community forums and appears to be some solutions for customfields, but due date is a system field (and I can't quite work out what to do).
Any help would be greatly appreciated.
Because this is an internet forum, allow me to first tell you that what you want is wrong. yyyy-mm-dd is God's own format that avoids all ambiguity, sorts naturally and is ISO-approved.
But if you really want to, this Groovy code reformats the due date:
DateTimeFormatter fmt = DateTimeFormat.forPattern("dd-MM-yyyy")
Go to the 'Script Fields' admin section, and create a new Script Field of type 'Custom Script Field', paste that in and preview with an issue that has a due date.
For Groovy scripting, a useful trick is to append '.class' to a known object to find it's type, then google that class to find what methods the class has. I start with 'issue', then find I can do 'issue.getDueDate()', and then google how to format a java.sql.Timestamp.
Thanks @Jeff Turner this is helpful and will do what the users want for their reporting.
Thanks also for your response - I'll give you a pass since its Friday and I can laugh it off. I guess from user's perspective the 'how it is' way is not helpful since Jira formats date fields in our instance the wrong way round but this is why we have scriptrunner to re-format things all the wrong ways :)
When to use CSV importer When managing your processes in Jira, there are many occasions where you need to create a lot of tasks. Creating them one by one will cost you a lot of time and effort and i...
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