Hello,
Upon submittal of a form in one of our service portals, we'd like to have 24 hours (or 1 day, however it needs to be interpreted) added to the system field, "Due Date." I've created this as a Behavior in ScriptRunner, but it's not working.
import java.sql.Timestamp
import java.util.concurrent.TimeUnit
def start = getFieldById("duedate")
def date = issueContext.created
def defaultValue = new Date(date.getTime() + TimeUnit.DAYS.toMillis(2)).format("dd/MMM/yy")
if (! start.getValue()) {
start.setFormValue(defaultValue)
}
Thanks in advance for any suggestions you can offer!
I haven't tested your script, but I would try moving this script to a custom script post function on the create step of your workflow.
Make sure the post function is before the Creates the issue originally step
You could probably simplify the code if it was a postfunction since it would grab the date at time of creation.
I've tested this in my environment and it is adding a day to the selected due date.
import java.sql.Timestamp
def cfDate = issue.dueDate;
def newDueDate = new Timestamp(cfDate.getTime() + 1 * 24 * 60 * 60 * 1000)
issue.setDueDate(newDueDate)
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.