Use Case: When a bug is filed as a Priority 0 or "P0", I want to trigger a validation rule that requires the user to enter information into a field ("Why is this a P0?")
Is this possible?
Hi @Hani Juha,
One solution is the following script if you have Script Runner add-on.
Paste the code;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.opensymphony.workflow.InvalidInputException
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField reasonFieldCF = customFieldManager.getCustomFieldObject("customfield_xxxxx");
if(issue.getPriority().getName().equals("P0")){
if(issue.getCustomFieldValue(reasonFieldCF) == null){
invalidInputException = new InvalidInputException("Please fill the reason field.")
}
}
Also, you can do it via Behaviours feature. There are many examples on the web.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.