Example scripts
To homepage
Jira

Dynamic Text Field
App in script

ScriptRunner For Jira
by Adaptavist
Compatibility

Jira (7.7 - 8.6)

ScriptRunner For Jira (5.6.14)
Language |
groovy
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
final singleSelectName = 'Some Single Select'
final textFieldName = 'Some Text Field'
def singleSelect = getFieldByName(singleSelectName)
def singleSelectValue = singleSelect.value
def textField = getFieldByName(textFieldName)
//Set the appropriate value, dependent on the value of the currently selected single select option
switch (singleSelectValue) {
//Change 'Single Select Option...' to match your single select's values.
case 'Single Select Option 1':
textField.setFormValue('New value for Single Select Option 1')
break
case 'Single Select Option 2':
textField.setFormValue('New value for Single Select Option 2')
break
case 'Single Select Option 3':
textField.setFormValue('New value for Single Select Option 3')
break
//Reset to default value if single select option is null or any other option that is not taken care of
default:
textField.setFormValue("")
}
Having an issue with this script?
Report it here