It is a A common use-case is to reset the checklist completely clear the checklist’s current content and build it from the ground up. This page will demonstrate how to achieve it.To assign a new set of items, you must create a new ArrayList<ChecklistItem>
:
First, you will need to create an empty collection (ArrayList<ChecklistItem
) that will contain the new items. You then create an item, add it to the collection and finally update the custom field passing it the newly created collection.
Code Block | ||
---|---|---|
| ||
// Create a new Checklist def ArrayList<ChecklistItem> newChecklistValue = new ArrayList<ChecklistItem>(); def item = checklistCustomFieldType.getSingularObjectFromString('{"name": "item name"}'); newChecklistValue.add(item); // Update the issue with the new checklist checklistCustomFieldType.updateValue(checklistCustomField, event.issue, newChecklistValue); |
...
Here is a complete example that updates the can be used to update a checklist with a new set of items:
...