AnsweredAssumed Answered

Advanced Workflow not triggering when saving a record on an Entry Point

Question asked by Lucas Albero on Sep 12, 2018

Hello,

 

I have created a custom button that sets a flag on a module. This flag activates an Advanced Workflow (That will have an approval process). The entry point works fine if the workflow is not active (calling it by navigating to < myInstance/index.php?entryPoint=NEC_BotaoSubmete_RD > or by the button), and the workflow works fine if I activate it manually. But if the field is set by the button, the workflow fails.

 

Here is the code of the entry point:

 

./custom/modules/Red_Relatorio_Despesas/NEC_BotaoSubmete_RD

// I'm using a defined id to test on a valid record
     $id_entrada = '90b37aa2-ad48-11e8-a2ff-0800270fcb6c';
    
    
     $mensagem = null;    
     try
     {    
          $rd_bean = BeanFactory::getBean('ReD_Relatorio_Despesas', $id_entrada, array('disable_row_level_security' => true));
          echo($rd_bean->status."\n");
          if(($rd_bean->status == "New" || $rd_bean->status == "Pending User") && ($rd_bean->resolution == "" || $rd_bean->resolution == null))
          {
               $rd_bean->aux_rd_c = true;

               $rd_bean->save();
          }
          else
          {
               echo("this report was already submited");
          }
         
     }
     catch(Exception $e)
     {
          $mensagem = $e->getMessage();
         
     }    
     echo("status: ".$mensagem);

 

And here is the error: 

An exception occurred while executing 'SELECT pmse_bpm_thread.cas_thread_index FROM pmse_bpm_thread WHERE (cas_id=) AND (pmse_bpm_thread.deleted = ?)' with params [0]:

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND (pmse_bpm_thread.deleted = ?)' at line 1

 

What could cause this error? Is there a limitation in the Sugar Entry Point where I can't save a bean in it or where I cannot expect it to trigger an workflow?

 

Thank you for your help!

Outcomes