I'm trying to get a checkbox value through ScriptRunner.
My checkbox field has only one option.
I found a similar question and tried the same code. (https://community.atlassian.com/t5/Jira-Core-questions/How-to-get-checkbox-value-with-scriptrunner-in-post-function/qaq-p/278604)
However, it didn't work in my environment. "No such property: value for class: java.lang.object" message appeared in the line of 'customField.getValue(issue)*.value'
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Additional Access");
def selectedValues = customField.getValue(issue)*.value
if ("Email Required" in selectedValues) {
// Do something
}
Should I add any import modules? I am very new to groovy. I have read lots of posts before about this but can't get it working. I would appreciate your help.
Hello @Haru ,
Where are you trying to use this script? Because this one works only in the context of a post-function.
For example, if it is a script listener, it will be a completely different logic.
In a listener, you would also need the following imports :
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
The more details you can give me, the most I will be able to help.
Best regards,
JT
I'll try it. Thank you so much, JT!
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.