It is indeed possible, but you need to look at the Java documentation for the Date class (your snippet above is incorrect).
And you should see an error message in Atlassian-Jira.log right after displaying an issue that should show your calculated field.
Finally, you can use Java Date methods to get the current date as well as to add to a date.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good!
Care to share your solution here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This works in my case: due date (=current date) + 9 days.
import java.text.SimpleDateFormat; import java.util.Date; SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yy"); Date dt = new Date(); long time = dt.getTime()+9*24*60*60*1000; String duedate = sdf.format(time);
duedate.jpg
pf.jpg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@abstractelement, Could you please help to modify above script to work only for due date. That is Due Date should be set as on when transition is made. I tried modifying the below line in above script but it didn't work.
long time = dt.getTime();
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you use JMWE plugin or some another plugin? What is the date pattern for your JIRA instance? What have you configured in details?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suresh, I'm not sure I understood what you're trying to do. Are you trying to set the Due Date field to "now"? If so, just use the following script:
new Date()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Thank you for your quick response.
Yes, your understanding is correct. I want to set Due Date to "now". Could you please provide the complete script David.
Yes, we do have a JMWE plugin where I have configured start date. However, Due Date isn't mentioned in the drop down list. So, need help with the script to implement the same. Due Date should choose the system date on when this transition is done.
Date format: dd/MMM/yy
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Thank you for your quick response.
Yes, your understanding is correct. I want to set Due Date to "now". Could you please provide the complete script David.
Yes, we do have a JMWE plugin where I have configured start date. However, Due Date isn't mentioned in the drop down list. So, need help with the script to implement the same. Due Date should choose the system date on when this transition is done.
Date format: dd/MMM/yy
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Thank you for your quick response.
Yes, your understanding is correct. I want to set Due Date to "now". Could you please provide the complete script David.
Yes, we do have a JMWE plugin where I have configured start date. However, Due Date isn't mentioned in the drop down list. So, need help with the script to implement the same. Due Date should choose the system date on when this transition is done.
Date format: dd/MMM/yy
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Thank you for your quick response.
Yes, your understanding is correct. I want to set Due Date to "now". Could you please provide the complete script David.
Yes, we do have a JMWE plugin where I have configured start date. However, Due Date isn't mentioned in the drop down list. So, need help with the script to implement the same. Due Date should choose the system date on when this transition is done.
Date format: dd/MMM/yy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't understand by what you mean by "we do have a JMWE plugin where I have configured start date".
Anyway, in the "Set Field Value (JMWE add-on)" post-function, the Due Date field should appear in the list of fields. And all you need is to set the value to the following Groovy expression:
new Date()
Which version of JMWE and Jira are you using?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
David, Sorry there was a mix up here.. My answers were for you and @abstractelement.
We can implement Start date field to pick transition date through JMWE plugin in Jira, however for Due Date it's not possible. Hence, other way is to do this using script-post function offered by Adaptavist Script runner.
David: I am clear with your answer now, I'll check and confirm the same.
Fyi.. Jira - 7.6.3 and JMWE: 5.1.1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't understand why it's not possible for Due Date...
Also, you can also create a Scripted (Groovy) post-function using JMWE...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks David for quick response. There is no Due Date in the drop down list, when tried to implement the same way as when using Start Date(used "Update Issue Custom Field (JSU)". This is offered by Suite Utilities for Jira (JSU). Sorry for creating confusion.
Thanks a lot. I'll test the way you have advised.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually, something like:
import org.apache.commons.lang3.time.DateUtils; return DateUtils.addDays(new Date(), 9);
would be simpler.
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.
It should be, but you'll need to tell us more about what you're trying.
We probably still need to see the error message.
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.
Might be worth explaining
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.