If a user inputs a custom field date picker, how can I script it into a date time?

For example - on the 'create' form a user selects a date picker to populate customfield 'Meeting Date' - say 8/10/2017. How can I write a script to automatically populate a customfield 'Meeting Start' with a fixed time, to make it '8/10/2017 08:30:00'? So it would be set at 8:30am for whatever date the user picks


Thanks for any feedback!

1 answer

You could do with this in a script field. I wrote the following script that will:

  • Get the value from a Date Picker field ("Meeting Date")
  • Format that value to be "month/day/year 8:30:00"
  • Displays value in the scripted field ("Meeting Start")
import com.atlassian.jira.component.ComponentAccessor
import java.text.SimpleDateFormat
enableCache = {-> false}
def customFieldManager = ComponentAccessor.getCustomFieldManager()
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy 08:30:00")
def meetingDate = customFieldManager.getCustomFieldObjectByName("Meeting Date")
return sdf.format(issue.getCustomFieldValue(meetingDate))


Screen Shot 2017-08-15 at 12.56.39 PM.png

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

685 views 6 13
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you