Simple Script Validator for Component values

JMP Support August 5, 2020

Hi all,

 

We have 2 kinds of Components: IT and Business.

Business Components are: PI Planning, Business Go-Live.

IT is the rest.

Can you help with writing a simple script validator, which validates that the Component field shouldn't have only Business Components, but at least one IT Component?

 

Thank you,

Duong

 

1 answer

1 vote
Sylvain Leduc
Contributor
September 22, 2023

Please find the behaviour script here - credits to Original Poster https://community.atlassian.com/t5/Jira-questions/Need-to-restrict-Component-s-to-single-select-using-ScriptRunner/qaq-p/680112?anon_like=1751359

It works with JSW 8.20.

def ComponentsField = getFieldById("components")
def components = ComponentsField.getValue() as Collection
if (components.size() > 1) {
ComponentsField.setValid(false)
ComponentsField.setError("Component can only be one value.")
}
else {
ComponentsField.setValid(true)
ComponentsField.clearError()
}

Suggest an answer

Log in or Sign up to answer