How to create a logical hook in SuiteCRM for the last activity date in the list view during task creation / editing in the target details view?

Create a logical after-save hook in SuiteCRM for the last activity date in the list view during task creation / editing in the target detail view.

+4
source share
1 answer

Create a field as last_activate_date in the Targets module or in your module through Admin> Studio> Targets> Fields.

It will be created in the table future_cstm as last_activity_date_c.

Add the code to custom / modules / Tasks / logic_hooks.php. If logic_hooks.php does not exit create logic_hook.php.

$hook_array['after_save'] = Array();
$hook_array['after_save'][] = Array(
    78,
    'Retrieve and compare values',
    'custom/modules/Tasks/lastActiveDate.php',
    'lastActiveDate',
    'after_save_method'
);

lastActiveDate.php :

.

if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class lastActiveDate
{

    function after_save_method($bean, $event, $arguments)
    {
        $module=$bean->parent_type;
        $record_id=$bean->parent_id;
        $bean1 = BeanFactory::getBean($module, $record_id);
        $tblname = $bean1->table_name;
        $tblname_cstm = $tblname."_cstm";
        $bean->db->query("UPDATE ".$tblname_cstm." SET last_activity_date_c=now() WHERE id_c='".$bean1->id."'");
    }
}

last_activity_date_c feild .

"" > "" > "" > "" > "" " " .

View.

+5

Source: https://habr.com/ru/post/1606385/


All Articles