Hi!
I have a custom field (Date Time Picker) on a create issue screen. The Jira date time picker has the format yyyy-MM-dd HH:mm. On the create issue screen I would like to pre-populate with todays date and always HH:mm 08:00, for example todays date would be 2020-03-23 08:00 even though I register the ticket at 13:00, and the next day it would be 2020-03-24 08:00 and so on.
I have Scriptunner as a plugin so I believe this could be achived with a behaviour, however I don´t know how to write this groovy-script. Could someone point me in the right direction?
For anyone struggling with the same question as I had this was the solution for me:
import java.sql.Timestamp
import java.util.concurrent.TimeUnit
def date = getFieldById("create-date")
def start = getFieldById("customfield_13600")
def defaultValue = new Date(new Date().time + TimeUnit.DAYS.toMillis(0)).format("yyyy-MM-dd 08:00")
if (! start.getValue()) {
start.setFormValue(defaultValue)
}
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.