Hi,
I'm trying to achieve the above via Script Runner plugin (Behaviour). (I ignored whether the sprint is the active sprint or future sprint until I will solve this issue)
First, I tried this: (Added "Sprint" field to fields section in Behaviour & this is the server-side script)
def sprintCfVal = getFieldByName("Sprint").getValue()
def assignee = getFieldById("assignee")
if (sprintCfVal)
{
assignee.setRequired(true)
} else {
assignee.setRequired(false)
} But since Assignee default value is "Unassigned", assignee.setRequired(true) is meaningless here.
So I tried a different approach, trying to return an error whenever the issue has sprint value & Assignee is "Unassigned": (Added "Sprint" field to fields section in Behaviour & this is the server-side script)
import com.opensymphony.workflow.InvalidInputException
def sprintCfVal = getFieldByName("Sprint").getValue()
def assignee = getFieldById("assignee")
def assigneeVal = assignee.getValue()
if (sprintCfVal && assigneeVal == "")
{
def fldAssignee = getFieldById("assignee")
fldAssignee.setError("==" + assigneeVal + "==")
}
If I edit an issue & add it to a sprint when it's unassigned I do get the error.
However, if I try to correct this & assign the issue to a user in the same edit screen, I still get the same error message ("====") which means he still thinks the issue is unassigned.
I tried adding "Assignee" field to Behaviour field section and moved the previous code to be server-side script for that field but that didn't help.
Any advice/idea about what I'm doing wrong here?