Documentation

add

\CTaskCheckListItem::add(CTaskItemInterface $oTaskItem, array $fields)

Static method for creating checklist item. After checklist item is created successfully, returns object \CTaskCheckListItem.

Parameters

First parameter passes specific task object to attach checklist item to this task. Second parameter passes array of values for this checklist item.

ParameterDescriptionVersion
TITLE (required)  Checklist text. Can be passed to any string, except of empty string or string that contains spaces.

When TITLE is equal === (to three "equal" characters), then creates separator line instead of checklist item.

SORT_INDEX  Sort index. Integer. The higher the number, the higher item is listed.
IS_COMPLETE  Flag of completed checklist item.

EXample


$task = \CTaskItem::getInstance($taskId, $userId);

\CTaskCheckListItem::add($task, ['TITLE'=>'First item', 'SORT_INDEX'=>10, 'IS_COMPLETE'=>'N']);

\CTaskCheckListItem::add($task, ['TITLE'=>'Second item', 'SORT_INDEX'=>20, 'IS_COMPLETE'=>'N']);

\CTaskCheckListItem::add($task, ['TITLE'=>'Third item. Completed', 'SORT_INDEX'=>30, 'IS_COMPLETE'=>'Y']);


Events

OnBeforeTaskCheckListItemAdd ($task, $fields)
OnAfterTaskCheckListItemAdd ($task, $oldFields, $newFields)


REST запрос

// 20190207175030
// http://site.com/rest/1/********/tasks.task.checklist.add?taskId=1&fields[TITLE]=Hello%20world

{
  "result": {
    "item": [
      {
        "ID": "1",
        "CREATED_BY": "1",
        "TASK_ID": "1",
        "TITLE": "Hello world",
        "IS_COMPLETE": "N",
        "SORT_INDEX": "1"
      }
    ]
  },
  "time": {
    "start": 1549554630.441403,
    "finish": 1549554630.552115,
    "duration": 0.11071205139160156,
    "processing": 0.05162310600280762,
    "date_start": "2019-02-07T17:50:30+02:00",
    "date_finish": "2019-02-07T17:50:30+02:00"
  }
}


© «Bitrix24», 2001-2024
Up