Hi All,
I need to have Validator script for below scenario
Field3 need to be Mandatory and with condition
Field1 with value V1 And Field2 != null And during Transition from Open to InProgress status
Could someone please help me with the script?
Is there any other ways apart validator, we can implement it?
Regards,
Satya
I’m Charlotte, a support engineer at Appfire and I’m here to help you.
You didn’t mention what app you’re using to make the field mandatory.
If you have Jira Misc Workflow Extensions (JMWE) installed, you can use the Field Required Validator (JMWE app), that allows you to make a field required but with conditions.
For your specific case, I recommend doing something like this (I imagined that both fields were select list):
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
def customFieldManager = ComponentAccessor.customFieldManager
// Get field objects - replace with your exact field names
def field1 = customFieldManager.getCustomFieldObjectsByName("Mandatory")?.first()
def field2 = customFieldManager.getCustomFieldObjectsByName("Area")?.first()
// Get the selected options
def field1Option = issue.getCustomFieldValue(field1) as Option
def field2Option = issue.getCustomFieldValue(field2) as Option
// Check conditions
def field1IsV1 = field1Option?.value == "Yes" // Compare with option value
def field2IsSelected = field2Option != null // Just check if any option is selected
// Return true only when both conditions are met
return field1IsV1 && field2IsSelected
You only need to update the script with the name of the fields and the options you use in your instance.
Please contact our support if you have any other questions about this validator, or JMWE in general.
We’ll be happy to help you! 😉
HI,
Thanks for the info
We are not having JMWE plugin in our application. We only have ScriptRunner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.