Hi,
I have a radio button type custom field "Test" with options "Not Started", "Started", "Staged", "Rejected" while creating the issue in Jira.
If option "Started" is selected in the radio options, a custom field named "Flow" need to appear on the create screen, if any other option is selected "Flow" custom field should be hidden.
I tried few behaviors scripts in script runner but none worked, can anyone help on this??
Hi @KSKumar55
Your code will not work as expected.
If you want the Behaviour to trigger based on the value of another field, you will need to use the Server-Side Behaviour. The Initialise will not do.
Regarding the radio button's Behaviour, it may be related to the SRJIRA-5699 Bug.
To proceed, please try these steps:-
If you are using the Optional / Required Toggle, your Server-Side Behaviour code should be something like this:-
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours behaviours
def radioButton = getFieldById(fieldChanged)
def radioButtonValue = radioButton.value as String
def textField = getFieldById('Sample Text Field')
textField.hidden = true
if (radioButtonValue == 'Option 1') {
textField.hidden = false
}
I hope this helps to solve your question. :)
Thank you and Kind regards,
Ram
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.
@Pramodh M , I tried the code in above mentioned url, but it didn't work after saving the behavior settings.
The custom field is not appearing in the create issue screen.
I executed the script in inline console of the initialiser.
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.
@Vikrant Yadav , @Pramodh M , I added the field as shown in the screenshot but still unable to make it work, can you please help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @KSKumar55 Kindly apply Behaviour on Test Field, like below screenshot :-
Instead of making field mandatory from Behaviors, it would be better use Field Configuration for making field mandatory , so that None option won't visible on screen.
def test = getFieldById(getFieldChanged())
def testvalue = test.getValue() as String
def flow = getFieldById("description") //replace with your custom field id
test.setRequired(true) //kindly make field mandatory from field configuration
if (testvalue == "Started") {
flow.setHidden(false)
}else {
flow.setHidden(true)
}
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.