Documentation

addByTemplate

CTaskItem[]
CTaskItem::addByTemplate(
         $templateId, 
         $executiveUserId,
         $overrideTaskData = array(), 
         $parameters = array() 
)

The method adds task to a template.

Returned value

This method returns an array of created [link=32362]CTaskItem[/link] class instances.

Note: The method accepts an array of configuration parameters and generates scripts, necessary to show file dialog. Static methods.

Method parameters

Parameter Description
$templateId Template ID.
$executiveUserId Task executor ID.
$overrideTaskData Array of redefined fields in task.
$parameters Array of the template parameters.

Example of use

CModule::IncludeMOdule('tasks');
$res = CTaskItem::addByTemplate(50, 1, false);
foreach($res as $taskInst)
{
    $data = $taskInst->getData(false);
    print($data['ID'].' -> '.$data['TITLE'].PHP_EOL);
}

© «Bitrix24», 2001-2024
Up