How To Store The Date of A Field Change?

I would like to store the date when the RLI Sales Stage changes. I've tried various techniques including Custom Calculated Fields and SugarBPM, but I can't quite find the right method to accomplish this. I've looked at several solutions, but can't seem to make them work...

Any thoughts out there? Thanks ahead of time! VO

Parents
  • I have not worked with RLIs but I assume you can work with logic hooks. In which case, I would use a simple before save logic hook.

    I do this in Cases to record the date of the last Status change:

    I created a field in cases case_last_status_change_date_c of type DateTime

    then in the before save logic hook I compare the status to see if it changed:

    function before_save ($bean,$event,$arguments){
       $today = $GLOBALS['timedate']->nowDb();
       if($bean->status != $bean->fetched_row['status']){          
          $bean->case_last_status_change_date_c = $today;
       }
    }
    
    

    (I use a variable for the timestamp because I use it elsewhere in my before save logic too)

    FrancescaS

  • Hello Francesca,

    I have drawn an after_save logic hook for this case and it works.

    Do you suggest switching in the logic hook drawing above from after_save to before_save in the starting On Data Change operator?
    Is there a reason for that?

    Thanks,

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient

Reply Children