AnsweredAssumed Answered

SugarCRM CE Calculated fields: Days difference between today's date and the creation date

Question asked by Liliana Carballo on Jul 1, 2015
Latest reply on Jul 6, 2015 by arturo.hernandez
Hi,

We're trying to get the total days old of a record getting the difference between 2 dates, we know that in order to create a calculated field on this edition we need the logic_hooks_class but it's not working.

<?php
    $hook_array = Array();      $hook_array['before_save'] = Array();
    $hook_array['before_save'][] = Array(
        //Processing index. For sorting the array.
        1,
      
        //Label. A string value to identify the hook.
        'calculate',
      
        //The PHP file where your class is located.
        'custom/modules/(modulename)/logic_hooks_class.php',
      
        //The class the method is in.
        'logic_hooks_class',
      
        //The method to call.
        'before_save_method'
    );  ?>

This is just the first of plenty calculated fields that we need to create, how can we do this?

Thank you.

Outcomes