Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Want to validate a transition based on radio field and an issue picker field

SysAdmin October 9, 2025

Hi,

Radio Button Field should be YES and stories in an issue picker field should be in Done or Cancelled status to allow the transition otherwise blocking the execution of the transition.

We have Jira datacenter v9.4.1 with script runner and JMWE plugins.

Regards,

1 answer

1 vote
Valerie Knapp
Community Champion
October 9, 2025

Hi @SysAdmin , thanks for your post.

Please reference the product documentation for JMWE here - https://appfire.atlassian.net/wiki/spaces/JMWE/pages/462062626/Linked+Issues+Status+Validator and https://appfire.atlassian.net/wiki/spaces/JMWE/pages/461439641/Field+has+single+value+Validator and let us know where you get stuck or need help.

Best wishes

SysAdmin October 9, 2025

@Valerie Knapp ,

This will require a scripted validator. Issue Picker Field is a custom field which will have to be checked for all stories to be closed alongwith a radio button field to be YES which will allow the transition.

 

Regards,

Valerie Knapp
Community Champion
October 9, 2025

Hi @SysAdmin , I can't speak for other champions but asking people to prepare you a scripted validator is something that I would consider to be paid work.

This is why I asked you to attempt to do it yourself and then ask for help.

Best wishes

SysAdmin October 9, 2025

Hi,

The script below does not block the transition.

And prints the logs as:

 

"

2025-10-09 17:27:49,696 WARN [jira.groovy]: Radio button value: YES

2025-10-09 17:27:49,696 WARN [jira.groovy]: Linked Stories field value: YES

2025-10-09 17:27:49,697 WARN [jira.groovy]: Validation failed: TEST-931 is in 'Open' (must be Done or Cancelled)

"


import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField

def log = org.apache.log4j.Logger.getLogger("com.onresolve.jira.groovy") // Create logger

// Get custom fields
def customFieldManager = ComponentAccessor.customFieldManager
def issueManager = ComponentAccessor.issueManager

def issuePickerCF = customFieldManager.getCustomFieldObjectByName("Linked Stories")
def radioButtonCF = customFieldManager.getCustomFieldObjectByName("Impacting Digital Channel")

log.debug("=== Validation started for issue: ${issue.key} ===")

// Get field values
def issuePickerValue = issue.getCustomFieldValue(issuePickerCF)
def radioButtonValue = issue.getCustomFieldValue(radioButtonCF)?.toString()?.trim()

log.debug("Radio button value: ${radioButtonValue}")
log.debug("Linked Stories field value: ${issuePickerValue}")

// Validate radio button
if (radioButtonValue != "YES") {
log.warn("Validation failed: Radio button is not set to YES (current value: ${radioButtonValue})")
return "Radio button must be set to YES."
}

// Validate linked issues
if (issuePickerValue instanceof List) {
log.debug("Multiple linked issues found: ${issuePickerValue.size()}")
for (def linkedIssueObj : issuePickerValue) {
def linkedIssue = issueManager.getIssueObject(linkedIssueObj.toString())
log.debug("Checking linked issue: ${linkedIssue?.key} | Status: ${linkedIssue?.status?.name}")

if (linkedIssue && !(linkedIssue.status.name in ["Done", "Cancelled"])) {
log.warn("Validation failed: ${linkedIssue.key} is in '${linkedIssue.status.name}' (must be Done or Cancelled)")
return "All issues in the issue picker must be in 'Done' or 'Cancelled' status. Issue ${linkedIssue.key} is in '${linkedIssue.status.name}' status."
}
}
} else if (issuePickerValue) {
// Handle single value case
def linkedIssue = issueManager.getIssueObject(issuePickerValue.toString())
log.debug("Single linked issue found: ${linkedIssue?.key} | Status: ${linkedIssue?.status?.name}")

if (linkedIssue && !(linkedIssue.status.name in ["Done", "Cancelled"])) {
log.warn("Validation failed: ${linkedIssue.key} is in '${linkedIssue.status.name}' (must be Done or Cancelled)")
return "The issue in the issue picker must be in 'Done' or 'Cancelled' status. Issue ${linkedIssue.key} is in '${linkedIssue.status.name}' status."
}
} else {
log.debug("No linked issues found in the field.")
}

// If all validations pass
log.debug("Validation passed successfully for issue: ${issue.key}")
return null

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.4.1
TAGS
AUG Leaders

Atlassian Community Events