I need a script that will check and see if the due date is != null and if it has a value, then make the due date read only, else the due date should be writeable. I am not able to get this to work.
I have been trying to get this to work with behaviors but have been unsuccessful. I would prefer to have a script and not pick the workflow and steps because not all the projects this is to be used for share the same workflow and I don't want to have multiple behaviors for each of the workflows.
I am new to scripting and when trying to use the below it is making the field read only all the time.
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import java.sql.Timestamp
def dueDate = getFieldByName("Due Date")
if (dueDate != "") {
dueDate.setReadOnly(true)
}
else {
dueDate.setReadOnly(false)
}