Audit Logs are not Showing in View Change Log

Dear Team,

With reference to below link we managed to create users_audit table automatically by creating an entry in the /custom/Extension/modules/Project/Ext/Vardefs/enableAuditing.php file. The logs are getting captured in the table however the view change log was still not showing data. Then we saw accounts record and confirmed that’s change log is not working there either which means there is an issue even in the default modules.
https://sugarclub.sugarcrm.com/dev-club/f/questions-answers/847/adding-audit-to-projects-module

In Log file we are getting below error logs.
Thu Dec 3 11:32:43 2020 [8424][1][FATAL] SugarBean::populateDefaultValues $field_defs should be an array
Thu Dec 3 11:32:43 2020 [8424][1][FATAL] SugarBean::populateDefaultValues $field_defs should be an array
Thu Dec 3 11:32:43 2020 [8424][1][FATAL] Query Failed:SELECT accounts_audit.*, IFNULL(users.user_name, N’Unknown’) AS user_name FROM accounts_audit LEFT JOIN users ON accounts_audit.created_by = users.id WHERE accounts_audit.parent_id = N’1428b655-721e-7439-17d9-5fc76eeb33d0’ order by accounts_audit.date_created desc::: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]‘IFNULL’ is not a recognized built-in function name.

Environment: Windows server 2012
Microsoft SQL Server 2016
PHP 7.3
IIS

Thanks in Advance.

@ambitsoftware

If the file
custom/Extension/modules/Project/Ext/Vardefs/enableAuditing.php
have line:

$dictionary['Project']['audited'] =true,

It will be work if you do: Admin -> Repair -> Quick Repair and Rebuild

Sorry for typo, we have created file in /custom/Extension/modules/Users/Ext/Vardefs/enableAuditing.php as we wat to enable audit log for users module.
line: $dictionary[‘Users’][‘audited’] =true,

@ambitsoftware

I see that you wrote:

but the object is User (not Users). Perhaps it’s mistake.

  • User - object name
  • Users - module name

I tested it. It work for module Users without problem.
Steps:

  1. custom/Extension/modules/Users/Ext/Vardefs/enableAuditing.php
$dictionary['User']['audited']=true,
  1. custom/Extension/modules/Users/Ext/Vardefs/first_name.php (field for example)
$dictionary['User']['fields']['first_name']['audited']=true,
  1. Admin -> Repair -> Quick Repair and Rebuild
1 Like

What’s the SuiteCRM version? This is known issue

Start reading here, then follow the link below to the patch

Thank you so much…It’s working.