CBPDocument
CBPDocument is a helper class that contains static wrapper methods to conveniently use workflow module API.
For example, to launch a workflow by the code of its template, the following code can be used:
$runtime = CBPRuntime::GetRuntime(); $wi = $runtime->CreateWorkflow($workflowTemplateId, $documentId, $arParameters); $wi->Start();
Or, the following method can be used:
string CBPDocument::StartWorkflow($workflowTemplateId, $documentId, $arParameters, &$arErrors)which additionally processes exceptions, collecting them into an $arErrors array, and returns a workflow ID.
Class methods
Method | Description | Available from version |
---|---|---|
AddDocumentToHistory | This method adds current document version into history. | |
AutoStartWorkflows | This method launches workflows, configures for autorun. | |
CanOperate | This method verifies, whether the specified user can perform the indicated operation, if the document is in the indicated statuses. | |
CanUserOperateDocument | This method verifies, whether user can perform the specified operation with a document by means of requesting document entity. | |
CanUserOperateDocumentType | This method verifies, whether user can perform the specified operation with documents of this type by means of requesting document type entity. | |
DeleteWorkflowTemplate | This method deletes workflow template. | |
GetAllowableEvents | This method returns an events array, which can be sent to workflow in a specified status by a specified user. | |
GetAllowableOperations | This method returns an array of operations, which can be performed by the specified user, if the document has the indicated statuses. | |
GetDocumentState | The method designed to work with a document returns the status of the indicated workflow. | |
GetDocumentStates | This method returns an array of all workflows and their statuses for this document. | |
GetUserTasksForWorkflow | This method returns a task array for this user in the specified workflow. | |
GetWorkflowTemplatesForDocumentType | This method returns an array of workflow templates for this document type. | |
OnDocumentDelete | This method deletes all records, associated with the workflows module record document. | |
SendExternalEvent | This method sends an external event to a workflow. | |
StartWorkflow | This method launches workflow by its template code. It's a recommended method to launch workflows. | |
TerminateWorkflow | This method stops execution of workflow. | |
UpdateWorkflowTemplate | This method modifies workflow template parameters. |
© «Bitrix24», 2001-2024