Deleting items from checklists using SIL

You may want to remove some items from a checklist, but not all of them. This can be useful to filter out unnecessary items in a checklist.

To remove all items or reset a checklist, see Updating checklists with new sets of items using SIL instead.


Steps

  1. Retrieve the current list of checklist items converted from JSON to the oChecklistItem structure.

    oChecklistItem[] items = fromJson(DoD);
  2. Remove the targeted items from the collection.

    for(oChecklistItem item in items) { // We only keep items that are named "Code reviewed" or are checked if (item.name != "Code reviewed" && !item.checked) { items -= item; } }
  3. Update the custom field by passing it the newly created collection converted to JSON.

    DoD = toJson(items);

Example

Here is a full example that can be used to remove all items with the “Not Applicable” status:


SERVER DOCUMENTATION (On Cloud? Go here.)
Have questions? Contact our Service Desk for help anytime.