Closed LaurensCleyman closed 5 years ago
you have to rewrite everything, see example
Ok I'm a step closer thanks to the examples.
But how can I update the field 'age' with the result?
<?php
class ContactsWorkflow
{
public static function Leeftijd(Vtiger_Record_Model $recordModel)
{
\App\Log::trace('Entering leeftijd');
$birthday = $recordModel->get('birthday');
$id = $recordModel->get('contactid');
$from = new DateTime($birthday);
$to = new DateTime('today');
$age = $from->diff($to)->y;*/
//How to:
//UPDATE vtiger_contactdetails
//SET age = $age
//WHERE contactid = $id
\App\Log::trace('leeftijd');
}
}
@LaurensCleyman $recordModel->set('age', $age) $recordModel->save();
Hi all,
I want to invoke a custom function in my workflows. When I used Vtiger then the code below worked. In YetiForce this is different. Any ideas what is changed?
Goal: Calculate the age of a contact based on his birthday, then store this value in the field 'age'.