• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/integration/intranet/user.php
  • Класс: BitrixTasksIntegrationIntranetUser
  • Вызов: User::getByDepartments
static function getByDepartments(
	array $departmentsIds,
	array $fields = ['ID', 'UF_DEPARTMENT'],
	$withFired = false
): array
{
	$departmentsIds = array_unique(array_filter($departmentsIds));

	if (!$departmentsIds)
	{
		return [];
	}

	$select = array_unique(array_merge($fields, ['ID', 'UF_DEPARTMENT']));
	$filter = ['UF_DEPARTMENT' => $departmentsIds];
	if (!$withFired)
	{
		$filter['=ACTIVE'] = 'Y';
	}

	return UtilUser::getList([
		'select' => $select,
		'filter' => $filter,
	])->fetchAll();
}