Forums

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

Custom field required based on another custom field value (radio button)

siva
Contributor
March 28, 2022

Hello, 

Here i need custom field required  based on another custom field value. 

Required custom field is Appear (Text field multi line)

Based custom field is Popular (radio buttons)

In Popular field if we select 'YES' then  Appear field should be required field and we are using script runner addon (server) can any one please help me with the script and i'm new to script runner. Please help me how to achieve this script.

 

Thanks,

Siva

1 answer

1 accepted

0 votes
Answer accepted
siva
Contributor
March 28, 2022

Here the answer for above question

 

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

def AppearField = getFieldById(getFieldChanged())
def regressedVersionField = getFieldByName("Popular")

String AppearValue = AppearField.getValue()

if (AppearValue == "Yes") {
regressedVersionField.setRequired(true)
} else {
regressedVersionField.setRequired(false)


regressedVersionField.setAllowInlineEdit(true)
}

Suggest an answer

Log in or Sign up to answer