Forums

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

Unable to resolve class com.okapya.jira.customfields.ChecklistItem

Dawid Zielinski
December 19, 2017

So I have this code in a Scripted Field:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.okapya.jira.customfields.ChecklistItem
@WithPlugin("com.okapya.jira.checklist")

def isReady(checklist) {
def uncheckedExists = false
def uncheckedRequiredExists = false

for (checklistCondition in checklist) {
def checklistItem = ((ChecklistItem) checklistCondition)
if (!checklistItem.isChecked()) {
uncheckedExists = true
if (checklistItem.isMandatory()) {
uncheckedRequiredExists = true
break
}
}
}

if (uncheckedRequiredExists) {
return "Not-Ready"
} else if (uncheckedExists) {
return "Required-Ready"
} else {
return "Fully-Ready"
}
}

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def fieldDoR = customFieldManager.getCustomFieldObject("customfield_14004")
def checklistDoR = fieldDoR.getValue(issue)

return isReady(checklistDoR)

Sometimes it works and sometimes it doesn't.

JIRA (Data Center - 2 nodes) version: v7.3.3#73014
ScriptRunner version: 5.2.2

Please help :)

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 29, 2022

Jira Cloud and Server are two very different applications, and hence, so is Scriptrunner on the two platforms.

You can't "convert" a script, or even most of the settings from one to the other, you will have to re-implement what you are doing in the way the new platform needs to do it.

Start with a read through https://docs.adaptavist.com/sr4js/latest/scriptrunner-migration/migrating-to-or-from-cloud/migrate-from-scriptrunner-for-jira-server-to-cloud

TAGS
AUG Leaders

Atlassian Community Events