Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
workflows function expression

I`m trying to create a function based workflow to calculate two fields in a custom module. I configure the workflow like this:


And I create a entry in the workflow functions whit this code:

$Vtiger_Utils_Log = true;

require_once 'include/utils/utils.php';


require 'modules/com_vtiger_workflow/';

global $adb;

$emm = new VTEntityMethodManager($adb);

$emm->addEntityMethod("FacturaComisiones", "calcularCamposFrasComisiones", "flujos_trabajo/HandlerCalcularCamposFrasComisiones.php", "calcularCamposFrasComisiones");

echo 'add Workflow Custom Function calcularCamposFrasComisiones to facturaComisiones module is complete!';

The funtion appears in the list of the workflow configuration in the custom module, but when I try to launch it saving one element , nothig appears. The function contains this code:

function escribirLog($texto, $archivo = "calcularCampos.txt"){

    // una funcion para escribir un log de sucesos...

     $ddf = fopen($archivo,'a');

     fwrite($ddf,"[".date("r")."] $texto\r\n");  




function calcularCamposFrasComisiones($entity) {

    include '../';

    require_once 'include/database/PearDatabase.php';


    // se obtiene la id del objeto que vamos a utilizar (en este caso, la ID de la Remesa)

    global $adb, $thesoid;

    $id = $entity->getId();

    $id = explode("x", [i]$id );
    $thesoid = $id[1];


    escribirLog($thesoid,"calcularCampos.txt" );



But the log appears empty. If I call the function directly it works...

I don´t know if the function isn´t register, or the problem will be another

Thanbk you

Messages In This Thread
RE: workflows function expression - inspectorflint - 07-20-2021, 01:31 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)