Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
workflows function expression
i have a webform that sends a new contact to corebos
inside the data of the contact i have put a variable that is the contact_no -> CONTACTO_XXX
from this fiel i wan to create a workflow that setup another field that is a contact related fiel that has
the first field contact_no

i had been trying without success a lot of time and i cant find the solution

this is the expression of the workflow that dont works now
cf_1236 -> is the related contact that i want to update
cf_1234 -> this is the CONTACT_XXX thas is allready filled

cf_1236 = $(cf_1234 : (Contacts) contact_no)

you have to set the ID of the record, not the Contact Number field: contacted

You can do that either by changing the webform to send the internal ID instead of the number or using the new getIDof() workflow expression function.
thanks Joe, one of the options that i managed was to make a business map atached to a query that searches de contact id tor the incoming contatc_no and updates that field, but with that function you have implemented seems easyer
thanks, i am gonna try it :-D

ups... seems that that function its not availabele yet in the system
do i need to upgrade the full system or there its an option to only
upgrade workflows functions enhancements?
have to do the whole thing: be careful
i must to start working with the denormrelease but in this case
i had found a fast solution that is sending the id of the contact
directly form the form and now in the workflow it can attach
the relacted contact directly as I wanted

so for me to understand, from now on the released is denormalized as master?
if i want to upgrade i must denormalize the database first?
yes, correct, going forward the denormalization project is part of corebos
note that denormalizing is an optional choice

you can upgrade and not activate denormalization on any module, everything will keep working as before and the information will be saved in the same places

the idea is that you denormalize only those modules with a VERY large number of records and only if you need to
Muchas gracias Joe por aclararme un poco mas el condepto
creo que va a ser muy util para proyectos con mucho crecimiento

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
First, why not just use coreBOS native workflow expressions? You should be able to do everything you need directly there. We haven't been doing custom functions for a long time and the ones we do are REALLY specific and complex things or situations where we want to optimize speed. The workflow language should be powerful enough to do the calculations you need.

I'd say the function is incorrect because you have two different offsets including files:

include '../';
require_once 'include/database/PearDatabase.php';

one of those has to be wrong, because either you are in a subdirectory and can "go up one" to get in which case the include PearDatabase is going to fail, or you are at the top directory where the code will find Peardatabase but not

A few notes:

- load vtlib/Vtiger/Module.php, which will load everything you need
- save your logs in the logs directory: it is a security issue to leave them lying around anywhere that they can get downloaded from the internet, the logs director is protected (if you have your apache correctly configured)

Forum Jump:

Users browsing this thread: 1 Guest(s)