Это старая версия документа.


2016-05-08: Обновитесь до последней, улучшенной версии

Вы можете запустить Бизнес-Процесс вручную из панели в vTiger или посредством PHP-файла. Вам нужен следующий PHP-код:

require_once(vglobal('root_directory')."/modules/Workflow2/autoload_wf.php");
 
// The ID of the Workflow you want to execute
$workflow_id = 1;
// The user, which will be used for execution
$executionUserId = 1;
// Specify a CRMID if you want to execute the record in context of this record. (Important for field values)
$crmid = false;
 
$wfExecuter = new \Workflow\Execute();
$wfExecuter->setUser($executionUserId);
if(!empty($crmid)) {
   $wfExecuter->setRecord($crmid);
}
 
// Set the $env Variable, which is initially available in Workflow
$wfExecuter->setEnvironment(array("variable" => "value", "variable2" => "value2"));
 
$wfExecuter->runById($workflow_id);
 
// If you have created your own trigger to execute multiple workflows, you could use the following function
// Notice: Handling of configuration in Settings will be improved in future versions of Workflow Designer
// $wfExecuter->runByTrigger("TriggerKey");
Ваш комментарий. Вики-синтаксис разрешён:
  _      __   __ __   ____   ___    ____
 | | /| / /  / // /  /  _/  / _ |  / __/
 | |/ |/ /  / _  /  _/ /   / __ | / _/  
 |__/|__/  /_//_/  /___/  /_/ |_|/___/