• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/replicator/template/service/subtaskservice.php
  • Класс: BitrixTasksReplicatorTemplateServiceSubTaskService
  • Вызов: SubTaskService::add
public function add(): Result
{
	$result = new Result();
	$responsibleMemberIds = $this->repository->getTemplate()->getResponsibleMemberId();
	try
	{
		foreach ($responsibleMemberIds as $responsibleMemberId)
		{
			$this->fields['RESPONSIBLE_ID'] = $responsibleMemberId;
			$this->fields['PARENT_ID'] = $this->task->getId();
			$task = (new Task($this->userId))->add($this->fields);
			(new CheckListService($this->repository, $task, $this->userId))->copyToTask();
		}
	}
	catch (Exception $exception)
	{
		$result->addError(new Error($exception->getMessage()));
		return $result;
	}

	return $result;
}