Need to update a date field with tomorrows date.

We have one date field and after certain transition I want to set the date to tomorrows date for the date field using java script.

We are using jira 5.0.6

4 answers

This widget could not be displayed.

Mizan,

we need to do this in a transition called "approve" ..while doing an "approve"...the date field value should be automatically set to tomorrows date.

This widget could not be displayed.
Mizan Community Champion Jul 01, 2012

This is a task of a post function , how will you identify that a certain transition has taken place using javascript ?

A reference to set the date is here

This widget could not be displayed.
Mizan Community Champion Jul 01, 2012

I dont know whether this is possible using javascript but a better approach is to create a post function which will set the value of the date customfield to tomorrows date.

Post function can be a plugin or a groovy script (using script runner plugin) .

A similar groovy script example is here

This widget could not be displayed.

Just to be clear on your requirement

Reading your question implies the process should be:

  1. User clicks on transition
  2. User fills in data on screen
  3. User clicks "go"
  4. Date field X is set to "tomorrow" (along with all the other changes)

That's all fine up until the point at which you say "using javascript", because javascript runs on the client's browser. The transition happens on the server and you can't run javascript there. This is why you'd need a "post function" to do the work

However, I suspect that's not what you meant, and what you actually want is:

  1. User clicks on transition
  2. User gets a screen with the date pre-set to tomorrow
  3. User clicks "go"
  4. Date field X is set to whatever they entered or accepted

That is indeed a javascript trick

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

34 views 3 4
Join discussion

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