GetService
CBPRuntimeService
public function GetService($name)(
string name
);
This method returns a runtime service instance by its name.
Note: the following runtime services are available.
Name | Class | Description |
---|---|---|
SchedulerService | CBPSchedulerService | Serves to install an agent that will be executed within specified time and will send external events to the indicated workflow |
StateService | CBPStateService | Works with workflow status, saved in the database |
TrackingService | CBPTrackingService | Works with message recording to the log |
TaskService | CBPTaskService | Works with tasks |
HistoryService | CBPHistoryService | Works with document revision history |
DocumentService | CBPDocumentService | Designed to work with a document |
Method parameters
Parameter | Description |
---|---|
name | Service name |
Returned value
Service class, inherited from CBPRuntimeService.
Examples
<?
// Save document $documentId history on behalf of $userId user
$runtime = CBPRuntime::GetRuntime();
$historyService = $runtime->GetService("HistoryService");
$documentService = $runtime->GetService("DocumentService");
$historyIndex = $historyService->AddHistory(
array(
"DOCUMENT_ID" => $documentId,
"NAME" => "New",
"DOCUMENT" => null,
"USER_ID" => $userId,
)
);
$arDocument = $documentService->GetDocumentForHistory($documentId, $historyIndex);
if (is_array($arDocument))
{
$historyService->UpdateHistory(
$historyIndex,
array(
"NAME" => $arDocument["NAME"],
"DOCUMENT" => $arDocument,
)
);
}
?>
© «Bitrix24», 2001-2024