How run workflow from code

Hi,
I have a custom workflow, how can i run one of the workflow by code.
I will create a new button for do that, a custom action or in controller.

Regards

bump :slight_smile:

can you share what you want to achieve? with an example maybe?

best regards

Hi,

create a basic workflow, say it “Send email to Contact Case Closure Template”.
when a case is closed, workflow send a email with case closure template.

What i will, is create a button in detail view… who launch (run) this workflow.

in // SuiteCRM/modules/AOW_WorkFlow/AOW_WorkFlow.php
you have function run_actions(SugarBean &$bean, $in_save = false){

i will do something like this in my controller :


require_once'modules/AOW_Workflow/AOW_Workflow.php')

class CustomAccountsController extends SugarController { 

	function action_Run_Workflow() 
{
       run_flow();  // SuiteCRM/modules/AOW_WorkFlow/AOW_WorkFlow.php
     or this  run_actions($bean);

   or 
    $flow = new AOW_WorkFlow();
   $flow->run_actions($bean, true);