This documentation is for version 4.x. For the latest documentation, click here

Update a checklist with a new set of items

A common use-case is to clear the checklist’s current content and build it from the ground up

First, you will need to create an empty collection (ArrayList<ChecklistItem) that will contain the new items.

def ArrayList<ChecklistItem> newChecklistValue = new ArrayList<ChecklistItem>();

You then create an item and add it to the collection.

def item = checklistCustomFieldType.getSingularObjectFromString('{"name": "item name"}'); newChecklistValue.add(item);

Finally, you update the custom field passing it the newly created collection.

checklistCustomFieldType.updateValue(checklistCustomField, event.issue, newChecklistValue);

Following is a complete example that can be used to update a checklist with a new set of items: