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:
// I'm using a defined id to test on a valid record
$id_entrada = '90b37aa2-ad48-11e8-a2ff-0800270fcb6c';
$mensagem = null;
$rd_bean = BeanFactory::getBean('ReD_Relatorio_Despesas', $id_entrada, array('disable_row_level_security' => true));
if(($rd_bean->status == "New" || $rd_bean->status == "Pending User") && ($rd_bean->resolution == "" || $rd_bean->resolution == null))
$rd_bean->aux_rd_c = true;
echo("this report was already submited");
$mensagem = $e->getMessage();
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 :
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!