Forums

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

How to get checkbox value with ScriptRunner: No such property error

Haru
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 13, 2020

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.

Error.png

1 answer

1 accepted

0 votes
Answer accepted
Jean-Théo [Adaptavist]
Community Champion
February 14, 2020

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

Haru
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2020

I'll try it. Thank you so much, JT!

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, out of office, loom, confluence, async collaboration, meeting recaps, remote teamwork, team alignment, knowledge sharing, AI-powered notes, productivity tools, workforce continuity, teamwork collection

Put your meeting notes on autopilot with Loom + Confluence

AI-powered meeting notes keep work moving even if you’re out of the office. Enjoy your well-deserved time off and return refreshed, confident you’ll catch up in no time.

Learn more
AUG Leaders

Atlassian Community Events