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)
}
Hi @Beth Starr
I had a quick look and my first inclination was the right one it seems... The answer is simpler and just leave "Due Date" off the edit screen as seen here. The answer @MoroSystems Support noted there was seconded by @Nic Brough who I've long respected in the "been there, done that, broke that" realm with Jira.
That is also my vote to simplify the solution without having something that needs to be maintained (not least of which your import com.atlassian.jira.component.ComponentAccessor which moves in the API when going to Jira 8)
I thought that would work too but since there are many projects that use the same configuration I can't remove it without impacting those projects. I need it to set the field as read only for just a few projects.
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.