Reputation: 11
I am a new learner of Jira and I have no experience with Script runner, And I trying to Write a script in ScriptRunner that gets initiated every time a user selects the “other” option. the "other" is one of four options which I added it under custom field and the type of this field is single select. what i have done is open scriptrunner> create listener> choose Custom listener> select the project> and write this script:
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObjectByName("impacted")
def cFieldValue = issue.getCustomFieldValue(cField)
If cFieldValue== "Other"
return "there is no another option"
this script didn't work with me. can any one give me . Can someone give me advice or help for script?
Upvotes: 1
Views: 3018
Reputation: 926
Simply append a .toString()
def cFieldValue = issue.getCustomFieldValue(cField).toString()
Maby you can replace your whole code with:
def cFieldValue = issue.getCustomFieldValue("impacted").toString()
Upvotes: 1