Versions Compared

Key

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

...

To add items, retrieve the custom field value and then add the desired items to it:

Code Block
languagejava
// Add an item to the Checklist
def ArrayList<ChecklistItem> existingChecklistValue = (ArrayList<ChecklistItem>) issue.getCustomFieldValue(checklistCustomField);
def newItem = checklistCustomFieldType.getSingularObjectFromString('{"name": "item name"}');
newItem.setRank(existingChecklistValue.size() + 1);
existingChecklistValue.add(newItem);

// Update the issue with the new checklist
checklistCustomFieldType.updateValue(checklistCustomField, event.issue, newChecklistValue);

...