Documentation

Frequently asked questions

Solutions for several frequent questions regarding tasks.



How to get filtered list of tasks via http query?

Task filters by ID, date, status. Its recommended to tasks.task.get for the filter '=ID' => 3 because it doesn't have pagewise navigation.

$filter = [];

//by id
$filter = [
    '>ID' => 3
];

$filter = [
    '=ID' => 3//recommend: CRest::call('tasks.task.get');
];


//by date
$filter = [
    '<CREATED_DATE' => date(DATE_ATOM, mktime(12, 22, 37, 7, 25, 2019))
];

//by status
$filter = [
    '>STATUS' => 2 // 2 is enum value. for current client: CRest::call( 'tasks.task.getFields');
];


$result = CRest::call(
    'tasks.task.list',
    [
        'filter' => $filter,
        'select' => [
            'ID',
            'TITLE',
            'CREATED_DATE'
        ]
    ]
);

//all fields
$fields = CRest::call( 'tasks.task.getFields');

echo '<pre>';
print_r([$filter, $result, $fields]);
echo '</pre>';



$result = CRest::call(
    'tasks.task.get',
    [
        'taskId' => 3,
        'select' => [
            'ID',
            'TITLE',
            'CREATED_DATE'
        ]
    ]
);
echo '<pre>';
print_r($result);
echo '</pre>';


© «Bitrix24», 2001-2022
Up