Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
languagejava
// Create a new Checklist
def ArrayList<ChecklistItem> newChecklistValue = new ArrayList<ChecklistItem>();

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

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

// Update the issue with the new checklist

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

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

...

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

...