Hi, I'm trying to add a validator on an existing transition.
"If the Fixversion field has no value, user should get a message "fix version must have a value", and is not allowed to transmit untill fixversion has a value"
I've tried this with custom fields - cfvalues['somefield'] - and this works for custum fields, but not for the field fixversion
Any ideas ?
You must add your .groovy script as validator for your transition.
You can use these codes as groovy workflow validator script
import java.util.ArrayList; import java.util.Collection; import com.atlassian.jira.config.ConstantsManager; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.project.version.Version; import com.opensymphony.workflow.InvalidInputException; Collection<Version> fixVersions = new ArrayList<Version>(); fixVersions = issue.getFixVersions(); if(fixVersions.size() == 0) invalidInputException = new InvalidInputException("fixVersions","Fix Versions field can not be empty.");
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG