Hey everyone.
Right now, when we're transitioning from one status to another, we use this kind of validator, written in script runner:
import com.opensymphony.workflow.InvalidInputException
if(issue.resolution.name == "Done" && issue.issueType.name== "UX task" || issue.issueType.name== "Spike")
{
}
else if (issue.resolution.name == "Done" && !issue.fixVersions ) {
throw new InvalidInputException("fixVersions",
"Fix Version/s is required when specifying Resolution of 'Done' when issue type is not 'UX Task' or 'Spike'")
}
else{
}
What does it to, it check status and issue types and throw some info and this is good. I'd like to add another condition - to have "Fix Version" field mandatory to update, but only if request has also certain priority (eg. High). I tried to add something like that into first if:
issue.priority.name == "Release Canceller" || issue.priority.name == "Hotfix")
But it didn't do the trick. Any suggestions?
EDIT: I might be dumber than I thought – this condition should be added into second if, as it's the source of the message. Will eventually confirm if this worked.
If someone need it:
import com.opensymphony.workflow.InvalidInputException
import com.atlassian.jira.issue.priority.Priority
if(issue.resolution.name == "Done" && issue.issueType.name== "UX task" || issue.issueType.name== "Spike")
{
}
else if (issue.resolution.name == "Done" && issue.priority.name == "Release Canceller" || issue.priority.name == "Hotfix" || issue.priority.name == "Critical" && !issue.fixVersions) {
throw new InvalidInputException("fixVersions",
"Fix Version/s is required when specifying Resolution of 'Done' when issue type is not 'UX Task' or 'Spike'")
}
else{
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.