Update bean via BeanFactory not save in change log. How do I keep in log (audit)?

Hi all,

$bean = BeanFactory::retrieveBean('Cases', $caseid, array('disable_row_level_security' => true));
$bean->status = $previousCaseStatus;
$bean->save();

I created custom EntryPoint.

I using BeanFactory to update record like code above but my sugar not keep record in change log.

I checked Audit for status filed in Studio but after I update via BeanFactory sugar not keep change log when I changed manually it save in change log.

How do I keep my updated record in change log ( <module>_audit ) ?

Ref: CRUD Handling

http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.5/API/Classes/SugarBean/CRUD_Handling/…

Sugarcrm Ent 7.6

Thanks,

M

  • Hi Autchara,

    Please confirm if you are providing new value for Status or using the same old value ? If there is a change in values, only then it will get logged in audit table. Secondly, is disabling the row level security causing this ? Please check and let us know if this helps.

    Regards.

  • Thank you for reply

    1. Confirm that value has been changed.

    2. In the second,

    I cannot remove the row level security because I use custom EntryPoint, it need to disabled this value to allow custom file to update via BeanFactory. I will check disable_row_level_security parameter.

  • Now I can fixed why log not keep.

    Because in cases_audit table in created_by field in NULL. I guest that It NULL because I put disable_row_level_security' => true into code. It's use to allow everyone can access this page, don't need authentication so everyone = NULL

    So it's my mistake that I'm not check before.

    My solution is using query to update latest audit record for each case, set created_by to 1 (admin). It's come back again.

    Thanks for all reply,

    M