Hi!
I have one question. For example I have a fieldA that has values (Val1 , Val2,Val3)
If I select val1 and val2 I want to change another fieldB and make it mandatory, if Val3 is chosen , nothing should happen. How can I do that?
Hi @QK,
Do you have Script Runner plugin? If yes,
def fieldA = getFieldById(getFieldChanged())
def fieldB = getFieldById("customfield_xxxxx")
String selectedOption = fieldA.getValue();
if(selectedOption.equals("Val1") || selectedOption.equals("Val2")){
fieldB.setRequired(true)
} else {
fieldB.setRequired(false)
}
Btw, there are different plugins on marketplace that provides this feature.
Tansu
Thank you,
I tried it but it doesn't work. Maybe I am writing something incorrectly. Can you tell me what field should I write in
getFieldById("customfield_xxxxx")
?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please write your customfield id of fieldB. Ex: customfield_12345.
In order to find it;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @QK
You can also use
getFieldByName(<name of your custom field>)
Please see the APIs here
https://scriptrunner.adaptavist.com/latest/jira/behaviours-api-quickref.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.