If your users are anything like ours, you’ve received the phone call or the email stating “someone deleted a record“. You get connected with the user and try to determine what happened. Do you end up looking at the Audit Trail for answers? Do you try to restore records manually based on details within the Audit Trail? If so, this new feature is for you…
Introducing the Audit Trail Restore feature now included in the Llamachant Framework Modules. We classify this feature as experimental because it has been tested in limited scenarios, it isn’t guaranteed to work with all XAF applications, and it’s designed to be used by technical staff rather than regular end users.
Also, we think you’ll love it…
Before reading any further, in order to use this module you MUST be using XPO as your data layer and you MUST have full auditing enabled on the objects that you wish to restore. Lightweight and Creation Only mode do not contain the details required to restore objects correctly. (DevExpress: Customize the Audit Trail System)
As you can see in the video above, the Tools tab now contains a Restore Data action that allows you to search for deleted objects within a specific date range, or where the display text contains a text string. When you restore an object, all related objects that were included in that delete operation, that are directly related to the object, will also be restored.
For example, if I delete a Client and it has an aggregated list of Contacts within, those contacts are marked as deleted and dissociated with the Client (aka, the Client field on the Contact is set to null). When I try to restore the Client, the Contacts that belong to that Client will also be restored. Alternatively, if I try to restore the Contact and the owning Client is deleted, the Client will also be restored.
Note: We HIGHLY recommend you backup your database before attempting to use this feature. As we said, it’s experimental and issues could arise from its use.
How to enable this feature
To enable this feature, set the CanRestoreFromAuditTrail within the Options node of the Model file to either “All” or “UserSpecific”. If you choose UserSpecific, we assume you are using a custom User class that implements our IAuditTrailUser interface. This allows you to specify per individual user if they are allowed to restore or not.