Documentation

CreateDocument

mixed
IBPWorkflowDocument::CreateDocument(  mixed pid,
 array arFields
);

This method creates new document with specified properties (fields) and returns its ID code.

Method parameters

ParameterDescription
pidNot used
arFieldsArray of document property values in the form of
array(
code_property => value,
...
)
Property code correspond to property codes, returned by the GetDocumentFields method.

Examples

<?
public function CreateDocument($pid, $arFields)
{
$iblockElement = new CIBlockElement();
$id = $iblockElement->Add($arFields);
if (!$id || $id <= 0)
throw new Exception($iblockElement->LAST_ERROR);
return $id;
}
?>


© «Bitrix24», 2001-2024