I'd like to have a field called "Due Date" that has a default value of 10 days from the current day. Is this possible? I don't see a way to do this using traditional methods, but perhaps it can be achieved through some creative javascript?
Not natively, but you're spot on with the javascript suggestion.
Try
{code}
<script language="javascript" type="text/javascript">
<!--
var startChg = document.getElementById("customfield_10288");
if (startChg)
{
var today=new Date()
today.setDate(today.getDate()+7)
startChg.value=today
}
// -->
{code}
"Bother!", said Pooh as he realised he didn't know how to do a code box in "Answers"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic - everybody votes! -> : https://jira.atlassian.com/browse/ANSWERS-57
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Nic! I'll give this a shot (adding a check to see if the value is currently empty before setting the default, of course).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Webwesen - Thanks! Voted
@circusdog - yes, sorry, I forgot, I was defaulting in a "create" screen. For edit, you should check the content first.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nic Brough
Thanks for your answer and Javascript.
It has worked halfway for me. It does successfully fill in the date field. But the format is incorrect.
As you may know, JIRA's date field is formatted "dd/MMM/yy h:mm a"
But the new Date() gives it "DDD MMM DD YYYY hh:mm:ss timezone"
Eg: "Tue Dec 23 2014 15:15:23 GMT+1100 (AUS Eastern Daylight Time)"
And to top it off, we can't manually update the date anymore.
Does anyone know how to format the date correctly again?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could also set up a post function using a groovy (or other) script that populates the dues date and add it to your workflow. While we did something similar to that with assigned date, though more complicated that what this would be. If you would like to see what we did you can read about it here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.