tasks.task.delegate
Делегировать задачу
Описание
Метод tasks.task.delegate меняет ответственного и делегирует задачу другому пользователю.
Проверить право на делегирование задачи можно методом проверки доступа к задаче.
Параметры
taskId
integer
обязательный
Идентификатор задачи.
Идентификатор задачи можно получить при создании новой задачи или методом получения списка задач
userId
integer
обязательный
Идентификатор пользователя, которому делегируется задача.
Идентификатор пользователя можно получить методом получения списка пользователей
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"taskId":8017,"userId":547}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/tasks.task.delegate
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"taskId":8017,"userId":547,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/tasks.task.delegate
// 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 TaskDelegateResult = {
task: {
id: string
title: string
responsibleId: string
status: string
}
}
try {
const response = await $b24.actions.v2.call.make<TaskDelegateResult>({
method: 'tasks.task.delegate',
params: {
taskId: 8017,
userId: 547,
},
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('Delegated task ID:', result.task.id, 'New responsible:', result.task.responsibleId)
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
<!-- 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 delegateTask() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'tasks.task.delegate',
params: {
taskId: 8017,
userId: 547,
},
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('Delegated task ID:', result.task.id, 'New responsible:', result.task.responsibleId)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', delegateTask)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.tasks.task.delegate(
task_id=8017,
user_id=547,
).response
result = bitrix_response.result
print(result)
except BitrixAPIError as error:
print(
"Ошибка Bitrix API",
f"error: {error.error}",
f"error_description: {error.error_description}",
sep="\n",
)
except BitrixSDKException as error:
print(f"Ошибка Bitrix SDK: {error.message}")
except Exception as error:
print(f"Непредвиденная ошибка: {error}")
try {
$response = $b24Service
->core
->call(
'tasks.task.delegate',
[
'taskId' => 8017,
'userId' => 547
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error delegating task: ' . $e->getMessage();
}
BX24.callMethod(
'tasks.task.delegate',
{
'taskId': 8017,
'userId': 547
},
function(result){
console.info(result.data());
console.log(result);
}
);
require_once('crest.php');
$result = CRest::call(
'tasks.task.delegate',
[
'taskId' => 8017,
'userId' => 547
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "tasks.task.delegate", b24.Params{
"taskId": 8017,
"userId": 547,
})
if err != nil {
return fmt.Errorf("tasks.task.delegate: %w", err)
}
keys, ok := b24.Keys(res.Result)
if !ok {
return fmt.Errorf("ожидался объект в ответе")
}
fmt.Println("полей в ответе:", len(keys))
Ответ
HTTP-статус: 200
{
"result": {
"task": {
"id": "8017",
"parentId": null,
"title": "Пример задачи",
"description": "Описание задачи с [B]форматированием[/B]",
"mark": "P",
"priority": "2",
"multitask": "N",
"notViewed": "N",
"replicate": "Y",
"stageId": "395",
"sprintId": null,
"backlogId": null,
"createdBy": "503",
"createdDate": "2025-06-04T16:15:55+03:00",
"responsibleId": "547",
"changedBy": "503",
"changedDate": "2025-09-18T12:05:02+03:00",
"statusChangedBy": "503",
"closedBy": "0",
"closedDate": null,
"activityDate": "2025-09-18T12:05:03+03:00",
"dateStart": "2025-09-10T15:22:12+03:00",
"deadline": "2025-09-11T08:00:00+03:00",
"startDatePlan": null,
"endDatePlan": null,
"guid": "{21e7b78d-498e-4c84-a896-2dbeb26861b8}",
"xmlId": null,
"commentsCount": "52",
"serviceCommentsCount": "36",
"allowChangeDeadline": "Y",
"allowTimeTracking": "Y",
"taskControl": "N",
"addInReport": "N",
"forkedByTemplateId": null,
"timeEstimate": "101580",
"timeSpentInLogs": "69963",
"matchWorkTime": "Y",
"forumTopicId": "1273",
"forumId": "11",
"siteId": "s1",
"subordinate": "Y",
"exchangeModified": null,
"exchangeId": null,
"outlookVersion": "70",
"viewedDate": "2025-09-18T12:05:03+03:00",
"sorting": null,
"durationFact": "1166",
"isMuted": "N",
"isPinned": "N",
"isPinnedInGroup": "N",
"flowId": "19",
"descriptionInBbcode": "Y",
"status": "2",
"statusChangedDate": "2025-09-18T12:05:02+03:00",
"durationPlan": "0",
"durationType": "days",
"favorite": "Y",
"groupId": "129",
"auditors": [
"61",
"103",
"503"
],
"accomplices": [
"3"
],
"checklist": {
"433": {
"id": "433",
"taskId": "8017",
"createdBy": "503",
"parentId": "431",
"title": "Первый",
"sortIndex": "0",
"isComplete": "N",
"isImportant": "N",
"toggledBy": null,
"toggledDate": null,
"ufChecklistFiles": false,
"members": [],
"attachments": [],
"entityId": "8017",
"action": {
"modify": true,
"remove": true,
"toggle": true,
"add": true,
"addAccomplice": true
}
},
"431": {
"id": "431",
"taskId": "8017",
"createdBy": "503",
"parentId": 0,
"title": "Чек-лист 1",
"sortIndex": "0",
"isComplete": "N",
"isImportant": "N",
"toggledBy": null,
"toggledDate": null,
"ufChecklistFiles": false,
"members": [],
"attachments": [],
"entityId": "8017",
"action": {
"modify": true,
"remove": true,
"toggle": true,
"add": true,
"addAccomplice": true
}
},
"435": {
"id": "435",
"taskId": "8017",
"createdBy": "503",
"parentId": "431",
"title": "Второй",
"sortIndex": "1",
"isComplete": "N",
"isImportant": "N",
"toggledBy": null,
"toggledDate": null,
"ufChecklistFiles": false,
"members": [],
"attachments": [],
"entityId": "8017",
"action": {
"modify": true,
"remove": true,
"toggle": true,
"add": true,
"addAccomplice": true
}
}
},
"group": {
"id": "129",
"name": "Новый поток",
"opened": false,
"membersCount": 1,
"image": "/bitrix/images/socialnetwork/workgroup/folder.png",
"additionalData": []
},
"creator": {
"id": "503",
"name": "Мария Иванова",
"link": "/company/personal/user/503/",
"icon": "https://mysite.ru/b17053/resize_cache/45749/c0120a8d7c10d63c83e32398d1ec4d9e/main/c89/c89c6b7301880958ea704b5a8470635c/4R5A1256.png",
"workPosition": "Администратор"
},
"responsible": {
"id": "547",
"name": "Мария",
"link": "/company/personal/user/547/",
"icon": "/bitrix/images/tasks/default_avatar.png",
"workPosition": "Тестировщик"
},
"accomplicesData": {
"3": {
"id": "3",
"name": "Андрей Карпов",
"link": "/company/personal/user/3/",
"icon": "https://mysite.ru/b17053/resize_cache/249/c0120a8d7c10d63c83e32398d1ec4d9e/main/cd526b0644e7ff4d794ea41cb36bc423/odmin.png",
"workPosition": "Системный администратор"
}
},
"auditorsData": {
"61": {
"id": "61",
"name": "Иван Петров",
"link": "/company/personal/user/61/",
"icon": "https://mysite.ru/b17053/resize_cache/8674/c0120a8d7c10d63c83e32398d1ec4d9e/main/7b5/7b52e4c2304ec0520dab3d4261e9ca1f/sp.jpg",
"workPosition": "Маркетолог"
},
"103": {
"id": "103",
"name": "Светлана Иванова",
"link": "/company/personal/user/103/",
"icon": "https://mysite.ru/b17053/resize_cache/8644/c0120a8d7c10d63c83e32398d1ec4d9e/main/45f/45fff10d17d398a5583184c8350cd197/buh.jpg",
"workPosition": "Бухгалтер"
},
"503": {
"id": "503",
"name": "Мария Иванова",
"link": "/company/personal/user/503/",
"icon": "https://mysite.ru/b17053/resize_cache/45749/c0120a8d7c10d63c83e32398d1ec4d9e/main/c89/c89c6b7301880958ea704b5a8470635c/4R5A1256.png",
"workPosition": "Администратор"
}
},
"newCommentsCount": 0,
"action": {
"accept": false,
"decline": false,
"complete": true,
"approve": false,
"disapprove": false,
"start": true,
"pause": false,
"delegate": true,
"remove": true,
"edit": true,
"defer": true,
"renew": false,
"create": true,
"changeDeadline": true,
"checklistAddItems": true,
"addFavorite": false,
"deleteFavorite": true,
"rate": true,
"take": false,
"edit.originator": false,
"checklist.reorder": true,
"elapsedtime.add": true,
"dayplan.timer.toggle": true,
"edit.plan": true,
"checklist.add": true,
"favorite.add": false,
"favorite.delete": true
},
"checkListTree": {
"nodeId": 0,
"fields": {
"id": null,
"copiedId": null,
"entityId": null,
"userId": 503,
"createdBy": null,
"parentId": null,
"title": "",
"sortIndex": null,
"displaySortIndex": "",
"isComplete": false,
"isImportant": false,
"completedCount": 0,
"members": [],
"attachments": [],
"nodeId": null
},
"action": [],
"descendants": [
{
"nodeId": 1,
"fields": {
"id": 431,
"copiedId": null,
"entityId": 8017,
"userId": 503,
"createdBy": 503,
"parentId": 0,
"title": "Чек-лист 1",
"sortIndex": 0,
"displaySortIndex": "",
"isComplete": false,
"isImportant": false,
"completedCount": 0,
"members": [],
"attachments": [],
"nodeId": null
},
"action": {
"modify": true,
"remove": true,
"toggle": true,
"add": true,
"addAccomplice": true
},
"descendants": [
{
"nodeId": 2,
"fields": {
"id": 433,
"copiedId": null,
"entityId": 8017,
"userId": 503,
"createdBy": 503,
"parentId": 431,
"title": "Первый",
"sortIndex": 0,
"displaySortIndex": "1",
"isComplete": false,
"isImportant": false,
"completedCount": 0,
"members": [],
"attachments": [],
"nodeId": null
},
"action": {
"modify": true,
"remove": true,
"toggle": true,
"add": true,
"addAccomplice": true
},
"descendants": []
},
{
"nodeId": 3,
"fields": {
"id": 435,
"copiedId": null,
"entityId": 8017,
"userId": 503,
"createdBy": 503,
"parentId": 431,
"title": "Второй",
"sortIndex": 1,
"displaySortIndex": "2",
"isComplete": false,
"isImportant": false,
"completedCount": 0,
"members": [],
"attachments": [],
"nodeId": null
},
"action": {
"modify": true,
"remove": true,
"toggle": true,
"add": true,
"addAccomplice": true
},
"descendants": []
}
]
}
]
},
"checkListCanAdd": true
},
"time": {
"start": 1758186302.475834,
"finish": 1758186304.093747,
"duration": 1.617913007736206,
"processing": 1.5874669551849365,
"date_start": "2025-09-18T12:05:02+03:00",
"date_finish": "2025-09-18T12:05:04+03:00",
"operating_reset_at": 1758186902,
"operating": 2.09035587310791
}
}
}
Возвращаемые данные
result
object
Объект с данными ответа
task
object
Объект с описанием задачи после выполнения операции
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 400
{
"error":"0",
"error_description":"Действие над задачей не разрешено"
}
| Код | Описание | Значение |
|---|---|---|
0 |
wrong task id | В параметре taskId указано значение неверного типа |
0 |
Действие над задачей не разрешено | У пользователя нет прав на делегирование задачи |
100 |
Could not find value for parameter \{userId\} | Не указан обязательный параметр userId |
100 |
CTaskItem All parameters in the constructor must have real class type | Не указан обязательный параметр taskId |

