Documentation

Add

bool
CTaskFiles::Add(
 array arFields,
 array arParams = array()
);

This method adds the "task -> file" association.

Method parameters

Parameter Description Available from version
arFields Array("field"=>"value", ...). Contains the following fields:
  • TASK_ID - Task ID;
  • FILE_ID - File ID.
arParams Array of additional parameters. Optional.

Returned value

This method returns true, if the adding was successful. If an error occurs, the method will return false, and exceptions will contain errors. 

Examples of use

<?
if (CModule::IncludeModule("tasks"))
{
$arFields = Array(
"TASK_ID" => 4,
"FILE_ID" => 15
);

$obTaskFiles = new CTaskFiles;
$ID = $obTaskFiles->Add($arFields);
$success = ($ID>0);

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

}?>


© «Bitrix24», 2001-2024