groovy add value to checklist field

Marzi Goodarzian
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 Leaders.
May 8, 2023

Hi 

I have a "multi Issue Picker" Field  that contains issues, and a "CheckList" Field, I want copy or add issues in "multi Issue Picker" Field to "CheckList" Field as Item.

I wrote a code but has a below problem:

Cannot cast object 'xxxx-159' with class 'com.atlassian.jira.issue.IssueImpl' to class 'com.okapya.jira.customfields.ChecklistItem'

How do fix it? How do convert these classes to each other ?

Thanks

1 answer

1 vote
Maxime Lefebvre _Okapya_
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 Leaders.
May 8, 2023

Hi Marzi,

I am a developer of Checklist for Jira and I'll help you find a solution.

You cannot simply take the value from one type of field and save it in another (unless they both store the same information!).

You appear to have a list of issues, and you want to add them to a list of checklist items.

Here's our ScriptRunner documentation on how to create checklist items and add them to the list.

You will need to loop over each value of the "multi issue picker" and create a checklist item for each of them. The item name could be the issue key issue.getKey() or the issue summary issue.getSummary().

If you need more guidance, it would help if you post your code so I can see what you are doing and provide the necessary changes to make it work.

Let me know how it goes!

Kind regards,
Maxime

Suggest an answer

Log in or Sign up to answer