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.ComponentAccessorimport com.atlassian.jira.issue.CustomFieldManagerimport com.atlassian.jira.issue.fields.CustomFieldimport com.opensymphony.workflow.InvalidInputExceptionCustomFieldManager 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.
It looks like you're new here. Sign in or register to get started.