public function Initialize(CBPActivity $rootActivity, $documentId, $workflowParameters = array(), $workflowVariablesTypes = array(), $workflowParametersTypes = array()) { $this->rootActivity = $rootActivity; $rootActivity->SetWorkflow($this); $arDocumentId = CBPHelper::ParseDocumentId($documentId); $rootActivity->SetDocumentId($arDocumentId); $documentService = $this->GetService("DocumentService"); $documentType = $documentService->GetDocumentType($arDocumentId); if ($documentType !== null) { $rootActivity->SetDocumentType($documentType); $rootActivity->SetFieldTypes($documentService->GetDocumentFieldTypes($documentType)); } $rootActivity->SetProperties($workflowParameters); $rootActivity->SetVariablesTypes($workflowVariablesTypes); if (is_array($workflowVariablesTypes)) { foreach ($workflowVariablesTypes as $k => $v) { $rootActivity->SetVariable($k, $v["Default"]); } } $rootActivity->SetPropertiesTypes($workflowParametersTypes); }