Hello,
I am trying to update value of the due date based on the priority selected. I have added a post function to enable the function but doesnt seem to work. Can anyone suggest why this is happening? I am using the below script.
Script:-
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.core.util.DateUtils
import org.apache.log4j.Logger
import org.apache.log4j.Level
import java.sql.Timestamp
def log = Logger.getLogger("com.onresolve.scriptrunner.runner.ScriptRunnerImpl")
log.setLevel(Level.INFO)
String priorityName = issue.getPriority().getName();
if(priorityName == "High"){
issue.setDueDate(new Timestamp((new Date() + 1).time))
log.info("The time is " + priorityName)
log.info("The time is " + Timestamp)
log.info("The time is " + Date)
} else if (priorityName == "Highest"){
issue.setDueDate(new Timestamp((new Date() + 2).time))
log.info("The time is " + priorityName)
log.info("The time is " + Timestamp)
log.info("The time is " + Date)
} else if (priorityName == "Medium"){
issue.setDueDate(new Timestamp((new Date() + 3).time))
log.info("The time is " + priorityName)
log.info("The time is " + Timestamp)
log.info("The time is " + Date)
} else{
issue.setDueDate(new Timestamp((new Date() + 4).time))
log.info("The time is " + priorityName)
log.info("The time is " + Timestamp)
log.info("The time is " + Date)
}
Based on the logs the script is executing but the Due Date is still empty.
Regards,
Sunil