AnsweredAssumed Answered

Trouble making an Audit Report

Question asked by Giovanni Marazzi on Feb 7, 2019
Latest reply on Feb 8, 2019 by Giovanni Marazzi

Greetings, Developers

 

I've been trying to adapt this documentation

https://support.sugarcrm.com/Knowledge_Base/Reports/Reporting_on_Records_Change_Log_Via_Advanced_Reports/ to create a report on contacts audit but suger insist my query is wrong.

SELECT
  IFNULL(c.id,'') as 'Id',
  IFNULL(ca.name,'') as 'Nome',
  IFNULL(ca.date_created,'') as 'Data criado',
  IFNULL(ca.created_by,'') as 'Criado por',
  IFNULL(ca.field_name,'') as 'Campo mudado',
  IFNULL(ca.before_value_string,'') as 'Antes',
  IFNULL(ca.after_value_string,'') as 'Depois'
FROM
  contacts as c
  INNER JOIN contacts_audit as ca ON ca.parent_id = c.id
WHERE
  ca.date_created >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
  AND c.deleted = 0

Every help is appreciated.

Outcomes