I am attempting to set the due to 14 days in the future. I am attempting to run the following as a sriptrunner post function but am getting no output. Can anyone see anything wrong with this script?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import java.sql.Timestamp;
int days = 14;
Calendar dueDate = Calendar.getInstance();
while (days > 0) {
dueDate.add(Calendar.DAY_OF_YEAR, 1)
--days;
}
/* Adjust for weekends > set to following Monday */
int dow = dueDate.get(Calendar.DAY_OF_WEEK);
if (dow == 7) {
dueDate.add(Calendar.DAY_OF_YEAR, 2)
} else if (dow == 1) {
dueDate.add(Calendar.DAY_OF_YEAR, 1)
}
issue.setDueDate(new Timestamp(dueDate.getTimeInMillis()));
Well, the code looks fine, I can't seem to spot something odd in this code. One thing that comes to my mind, is the post-function right at the top i.e. it should be the first post-function, if it's not the case can you please move it to the first position.
That is the case. IT also states that it is not failing. I have tested with the field being blank. I have also tested with due date being populated. If it is populated, the value is cleared.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had other post functions that were causing problems. Working fine now.
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.