Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
en:extensions:workflowdesigner:execute_workflows_from_php [2016/05/08 19:38] swarnat |
en:extensions:workflowdesigner:execute_workflows_from_php [2016/05/08 19:42] (current) swarnat |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Execution: Local with PHP ====== | ====== Execution: Local with PHP ====== | ||
| - | //DEPRECATED. Will be renewed. // | + | <WRAP center round tip 60%> |
| + | 2016-05-08: Updated to latest and easiest version | ||
| + | </WRAP> | ||
| You could execute a workflow manually in your own vtigerCRM extension or PHP file. | You could execute a workflow manually in your own vtigerCRM extension or PHP file. | ||
| Line 7: | Line 9: | ||
| <code php> | <code php> | ||
| - | global $root_directory; | + | require_once(vglobal('root_directory')."/modules/Workflow2/autoload_wf.php"); |
| - | require_once($root_directory."/modules/Workflow2/autoload_wf.php"); | + | |
| - | // The ID of the Workflow | + | // The ID of the Workflow you want to execute |
| $workflow_id = 1; | $workflow_id = 1; | ||
| // The user, which will be used for execution | // The user, which will be used for execution | ||
| Line 20: | Line 21: | ||
| $wfExecuter->setUser($executionUserId); | $wfExecuter->setUser($executionUserId); | ||
| if(!empty($crmid)) { | if(!empty($crmid)) { | ||
| - | $wfExecuter->setRecord($crmid); | + | $wfExecuter->setRecord($crmid); |
| } | } | ||
| Line 28: | Line 29: | ||
| $wfExecuter->runById($workflow_id); | $wfExecuter->runById($workflow_id); | ||
| - | // If you have created your own trigger, you could use the function | + | // If you have created your own trigger to execute multiple workflows, you could use the following function |
| - | // Handling of configuration in Settings will be improved in future versions of Workflow Designer | + | // Notice: Handling of configuration in Settings will be improved in future versions of Workflow Designer |
| - | $wfExecuter->runByTrigger("TriggerKey"); | + | // $wfExecuter->runByTrigger("TriggerKey"); |
| </code> | </code> | ||