I have a transition screen from which I am getting values(s) via a checkbox control, I need to get these values and update them on another checkbox control in the issues view screen. I tried the below code and it worked but it doesnt set the checkbox option as selected but just shows the value like a editable text but when I clicked edit that option is not selected.
def changeHolder = new DefaultIssueChangeHolder()
custField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(custField), platvalue),changeHolder)
I read that you need to use options , so I used the below code but it doesnt work
def optionsManager = ComponentAccessor.getOptionsManager()
def config = platRelOnAPIField.getRelevantConfig(issue)
def options = optionsManager.getOptions(config)
log.debug("Options of Plat rel on field in API:"+options) // This prints properly
def newOption = options.get(7) //I want to set to the 8th checkbox just for example,this value prints properly
ModifiedValue mVal = new ModifiedValue(issue.getCustomFieldValue(platRelOnAPIField),newOption);
platRelOnAPIField.updateValue(null, issue, mVal, new DefaultIssueChangeHolder());
But I end up with this exception
java.lang.ClassCastException: com.atlassian.jira.issue.customfields.option.LazyLoadedOption cannot be cast to java.util.Collection
I am a newbie to groovy/jira apis , so please can someone help me to set the checkbox value properly for the customfield
Ive checked this
https://community.atlassian.com/t5/Answers-Developer-Questions/Set-custom-field-select-list-value/qaq-p/491158
but I still get the same exception
Thanks !