I have gone all around the houses to try and find the right answer to this and desperately hoping someone can help. This is the query:
SELECT EntityView.LogicalName, CASE WHEN Audit.Operation = 1 THEN ‘Create’ WHEN Audit.Operation = 2 THEN ‘Update’ WHEN Audit.Operation = 3 THEN ‘Delete’ WHEN Audit.Operation = 4 THEN ‘Access’ END AS Action,
FORMAT(DATEADD(mi, DATEDIFF(mi, GETUTCDATE(), GETDATE()), Audit.CreatedOn), ‘dd/MM/yyyy HH:mm’) AS AuditCreated, Filteredrqia_registeredperson.rqia_registeredpersonidnumber AS RegisteredPerson, Audit.AttributeMask
FROM Audit INNER JOIN
EntityView ON Audit.ObjectTypeCode = EntityView.ObjectTypeCode INNER JOIN
Filteredrqia_registeredperson ON Audit.ObjectId = Filteredrqia_registeredperson.rqia_registeredpersonid
WHERE (EntityView.LogicalName = ‘rqia_registeredperson’) AND (Filteredrqia_registeredperson.rqia_registeredpersonidnumber = ‘RP023523’)
GROUP BY EntityView.LogicalName, FORMAT(DATEADD(mi, DATEDIFF(mi, GETUTCDATE(), GETDATE()), Audit.CreatedOn), ‘dd/MM/yyyy HH:mm’), Audit.Operation, Filteredrqia_registeredperson.rqia_registeredpersonidnumber,
Audit.AttributeMask
ORDER BY EntityView.LogicalName, AuditCreated
LogicalName is the name of the table in the database and RegisteredPerson is the ID of the service manager. All I would like to do is identify where changes have been made to a field called ‘Status’ in the LogicalName table and pull out the changes in the value. I have searched everywhere and cannot find an understandable solution. Is this really a complex thing to do?