Skip to content

Latest commit

 

History

History
388 lines (322 loc) · 11.8 KB

File metadata and controls

388 lines (322 loc) · 11.8 KB

Add Checklist Item with task.checklistitem.add

{% note tip "" %}

If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.

{% endnote %}

Scope: task

Who can execute the method:

  • any user with access to edit the task
  • Creator, Participant, and other Participants of the task

The method task.checklistitem.add adds a new checklist item to a task.

You can check permissions for adding an item using the method task.checklistitem.isactionallowed.

Method Parameters

{% include Note on required parameters %}

#| || Name type | Description || || TASKID* integer | Task identifier.

The task identifier can be obtained when creating a new task or using the get task list method || || FIELDS* object | Object with checklist item fields || |#

FIELDS Parameter {#fields}

{% include Note on required parameters %}

#| || Name type | Description || || TITLE* string | Text of the checklist item.

If PARENT_ID is passed with a value of 0, then TITLE is the name of the checklist || || SORT_INDEX integer | Sort index. The lower the value, the higher the item in the list or sublist || || IS_COMPLETE boolean | Status of the item. Possible values:

  • Y — completed
  • N — not completed

Default is N || || IS_IMPORTANT boolean | Mark indicating that the item is important. Possible values:

  • Y — important
  • N — normal || || MEMBERS object | Object describing the participants of the checklist item. Key — user identifier, value — object with the participant type parameter TYPE. Possible participant type values:
  • 'TYPE': 'A' — Participant
  • 'TYPE': 'U' — Observer

The system will add checklist item participants to the task in the same roles || || PARENT_ID integer | Identifier of the parent item. Use for nested checklists.

  • If PARENT_ID is passed with a value of 0, the system will create a new checklist in the task
  • If there is no checklist item in the task with the specified PARENT_ID, the system will create a new checklist
  • If PARENT_ID is not specified in FIELDS, the system will add a new item to the existing top-level checklist. If there is no checklist in the task, it will create a new one

|| |#

Code Examples

{% include Example Note %}

{% list tabs %}

  • cURL (Webhook)

    curl -X POST \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"TASKID":13,"FIELDS":{"TITLE":"Prepare the report","PARENT_ID":457,"SORT_INDEX":200,"IS_COMPLETE":"N","IS_IMPORTANT":"Y","MEMBERS":{"547":{"TYPE":"A"}}}}' \
    https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/task.checklistitem.add
  • cURL (OAuth)

    curl -X POST \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"TASKID":13,"FIELDS":{"TITLE":"Prepare the report","PARENT_ID":457,"SORT_INDEX":200,"IS_COMPLETE":"N","IS_IMPORTANT":"Y","MEMBERS":{"547":{"TYPE":"A"}}},"auth":"**put_access_token_here**"}' \
    https://**put_your_bitrix24_address**/rest/task.checklistitem.add
  • JS (TS)

    // This snippet is an ES module: top-level await requires type="module" or a bundler.
    // $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
    import { Text } from '@bitrix24/b24jssdk'
    import type { B24Frame } from '@bitrix24/b24jssdk'
    
    declare const $b24: B24Frame
    
    // Shape of the payload returned in result (match the "response handling" section of the page)
    type ChecklistItemAddResult = number
    
    try {
      const response = await $b24.actions.v2.call.make<ChecklistItemAddResult>({
        method: 'task.checklistitem.add',
        params: {
          TASKID: 13,
          FIELDS: {
            TITLE: 'Prepare the report',
            PARENT_ID: 457,
            SORT_INDEX: 200,
            IS_COMPLETE: 'N',
            IS_IMPORTANT: 'Y',
            MEMBERS: {
              547: {
                TYPE: 'A',
              },
            },
          },
        },
        requestId: Text.getUuidRfc4122()
      })
    
      // The payload is available only on a successful response
      if (!response.isSuccess) {
        console.error(response.getErrorMessages().join('; '))
      } else {
        const result = response.getData()!.result
        console.info('Created checklist item with ID:', result)
      }
    } catch (error) {
      // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
      console.error(error)
    }
  • JS (UMD)

    <!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
    <script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
    <script>
      async function addChecklistItem() {
        try {
          // Initialize the SDK inside a Bitrix24 frame
          const $b24 = await B24Js.initializeB24Frame()
    
          const response = await $b24.actions.v2.call.make({
            method: 'task.checklistitem.add',
            params: {
              TASKID: 13,
              FIELDS: {
                TITLE: 'Prepare the report',
                PARENT_ID: 457,
                SORT_INDEX: 200,
                IS_COMPLETE: 'N',
                IS_IMPORTANT: 'Y',
                MEMBERS: {
                  547: {
                    TYPE: 'A',
                  },
                },
              },
            },
            requestId: B24Js.Text.getUuidRfc4122()
          })
    
          // The payload is available only on a successful response
          if (!response.isSuccess) {
            console.error(response.getErrorMessages().join('; '))
            return
          }
    
          const result = response.getData().result
          console.info('Created checklist item with ID:', result)
        } catch (error) {
          // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
          console.error(error)
        }
      }
    
      document.addEventListener('DOMContentLoaded', addChecklistItem)
    </script>
  • PHP

    try {
        $response = $b24Service
            ->core
            ->call(
                'task.checklistitem.add',
                [
                    'TASKID' => 13,
                    'FIELDS' => [
                        'TITLE' => 'Prepare the report',
                        'PARENT_ID' => 457,
                        'SORT_INDEX' => 200,
                        'IS_COMPLETE' => 'N',
                        'IS_IMPORTANT' => 'Y',
                        'MEMBERS' => [
                            547 => [
                                'TYPE' => 'A'
                            ]
                        ]
                    ]
                ]
            );
    
        $result = $response
            ->getResponseData()
            ->getResult();
    
        echo 'Success: ' . print_r($result, true);
        processData($result);
    
    } catch (Throwable $e) {
        error_log($e->getMessage());
        echo 'Error adding checklist item: ' . $e->getMessage();
    }
  • BX24.js

    BX24.callMethod(
        'task.checklistitem.add',
        {
            'TASKID': 13,
            'FIELDS': {
                'TITLE': 'Prepare the report',
                'PARENT_ID': 457,
                'SORT_INDEX': 200,
                'IS_COMPLETE': 'N',
                'IS_IMPORTANT': 'Y',
                'MEMBERS': {
                    547: {
                        'TYPE': 'A'
                    }
                }
            }
        },
        function(result){
            console.info(result.data());
            console.log(result);
        }
    );
  • PHP CRest

    require_once('crest.php');
    
    $result = CRest::call(
        'task.checklistitem.add',
        [
            'TASKID' => 13,
            'FIELDS' => [
                'TITLE' => 'Prepare the report',
                'PARENT_ID' => 457,
                'SORT_INDEX' => 200,
                'IS_COMPLETE' => 'N',
                'IS_IMPORTANT' => 'Y',
                'MEMBERS' => [
                    547 => [
                        'TYPE' => 'A'
                    ]
                ]
            ]
        ]
    );
    
    echo '<PRE>';
    print_r($result);
    echo '</PRE>';
  • Go

    // client and ctx are already created — see the Go SDK section
    res, err := client.Core().Call(ctx, "task.checklistitem.add", b24.Params{
    	"TASKID": 13,
    	"FIELDS": b24.Params{
    		"TITLE":        "Prepare the report",
    		"PARENT_ID":    457,
    		"SORT_INDEX":   200,
    		"IS_COMPLETE":  "N",
    		"IS_IMPORTANT": "Y",
    		"MEMBERS": b24.Params{
    			"547": b24.Params{
    				"TYPE": "A",
    			},
    		},
    	},
    })
    if err != nil {
    	return fmt.Errorf("task.checklistitem.add: %w", err)
    }
    
    var newID b24.ID
    if err := json.Unmarshal(res.Result, &newID); err != nil {
    	return fmt.Errorf("parse response: %w", err)
    }
    fmt.Println("id:", newID)

{% endlist %}

Response Handling

HTTP Status: 200

{
    "result": 475,
    "time": {
        "start": 1762431907,
        "finish": 1762431908.259832,
        "duration": 1.2598319053649902,
        "processing": 0,
        "date_start": "2025-11-06T15:25:07+01:00",
        "date_finish": "2025-11-06T15:25:08+01:00",
        "operating_reset_at": 1762432508,
        "operating": 0.24803590774536133
    }
}

Returned Data

#| || Name type | Description || || result integer | Identifier of the new checklist item || || time time | Information about the request execution time || |#

Error Handling

HTTP Status: 400

{
    "error":"ERROR_CORE",
    "error_description":"TASKS_ERROR_EXCEPTION_#8; Adding item: action not allowed; 8/TE/ACTION_FAILED_TO_BE_PROCESSED<br>"
}

{% include notitle error handling %}

Possible Error Codes

#| || Code | Description | Value || || ERROR_CORE | TASKS_ERROR_EXCEPTION_#8; Adding item: action not allowed; 8/TE/ACTION_FAILED_TO_BE_PROCESSED
| No access to the task or insufficient permissions to work with checklists in the task || || ERROR_CORE | TASKS_ERROR_EXCEPTION_#256; Param #0 (taskId) for method ctaskchecklistitem::add() expected to be of type "integer", but given something else.; 256/TE/WRONG_ARGUMENTS | Required parameter TASKID not provided or incorrect type for TASKID || || ERROR_CORE | TASKS_ERROR_EXCEPTION_#256; Param #1 (arFields) expected by method ctaskchecklistitem::add(), but not given.; 256/TE/WRONG_ARGUMENTS
| Required parameter FIELDS not provided or empty || || ERROR_CORE | TASKS_ERROR_EXCEPTION_#8; Item name not specified; 8/TE/ACTION_FAILED_TO_BE_PROCESSED
| Required field TITLE not provided in the FIELDS parameter || |#

{% include system errors %}

Continue Learning