Documentation

Add

int
CTaskTemplates::Add(
 array arFields,
 array arParams = array()
);

The method adds new template.

Method parameters

Parameter Description Available from version
arFields Array("field"=>"value", ...). Contains values of all template fields.
arParams Array of additional parameters. Optional.

Returned value

The method returns the added template ID, if the adding was successful. When an error occurs, the method returns false, and exceptions will contain errors. 

Examples of use

<?
if (CModule::IncludeModule("tasks"))
{
$arFields = Array(
"TITLE" => "Task title",
"DESCRIPTION" => "Task description",
"RESPONSIBLE_ID" => 2,
"GROUP_ID" => 3
);

$obTemplate = new CTaskTemplates;
$ID = $obTemplate->Add($arFields);
$success = ($ID>0);

if($success)
{
echo "Ok!";
}
else
{
if($e = $APPLICATION->GetException())
echo "Error: ".$e->GetString();
}

}?>


© «Bitrix24», 2001-2024