Umbraco Forms - GDPR Data Retention - Remove after X period
Hi guys,
I've tried searching for a solution to this with no success. Essentially a client of ours would like to remove data submitted using via Umbraco Forms after so long. Joys of GDPR... Is this even possible?
I can see the data in the database which is split up into several tables and could write up a lengthy SQL stored procedure to find and delete data, but if there's a native or API approach then that'd be better.
As far as I know, it is not currently possible to store forms responses in a custom DB at the minute.
The "forms in the database" bit as I understanding it is the storing of the actual form definitions, workflows etc in the database instead of the flat files that they currently are.
I'm just having a dig in to this and I think setting up a scheduled task would be the most appropriate approach, but I'm still scratching my head about what to write within it.
I'm just taking a quick nosey into public methods of the DLL's and can see that the Umbraco Forms front end calls the Delete(Record record, Form form) method of the RecordService class within the Umbraco.Forms.Core.Services namespace. I just need to track down how to query the API to get the Record and Form objects.
If I happen to strike it lucky and figure this out I'll post my findings!
using (FormStorage formStorage = new FormStorage())
foreach (var form in formStorage.GetAllForms())
{
if (FormsSecurity.CanCurrentUserEdit(form.Id))
{
model.Form = form.Id;
var formRes = FormRecordSearcher.QueryDataBase(model);
if (formRes.TotalNumberOfResults > 0)
{
}
}
}
And then this for the delete:
if (FormsSecurity.CanCurrentUserEdit(model.FormId))
{
using (FormStorage formStorage = new FormStorage())
{
using (RecordStorage recordStorage = new RecordStorage())
{
var form = formStorage.GetForm(model.FormId);
var records = recordStorage.GetRecords(model.Records, form);
foreach (var record in records)
RecordService.Instance.Delete(record, form);
}
}
}
You could add filtering into that get aged results.
I assume the services etc would be similar/the same in v8
Umbraco Forms - GDPR Data Retention - Remove after X period
Hi guys,
I've tried searching for a solution to this with no success. Essentially a client of ours would like to remove data submitted using via Umbraco Forms after so long. Joys of GDPR... Is this even possible?
I can see the data in the database which is split up into several tables and could write up a lengthy SQL stored procedure to find and delete data, but if there's a native or API approach then that'd be better.
Many Thanks, Andy
Hi Andy,
OOTB there is nothing to do this, however it wouldn't be too hard to construct something I don't think.
I say that because I've created a dashboard where editors can manually do bulk removal for specific forms.
Things to note:
Thanks
Nik
Interestingly in forms version 9 it will be only possible to store form data in the database which if I am right translates as 'removing the ability to use custom db's to store data' https://our.umbraco.com/documentation/add-ons/umbracoforms/developer/Forms-in-the-Database/
Is my interpretation correct? It seems strange so I assume I am wrong but if I am right then there may be even more GDPR implications down the line.
Hey Tiffany,
As far as I know, it is not currently possible to store forms responses in a custom DB at the minute.
The "forms in the database" bit as I understanding it is the storing of the actual form definitions, workflows etc in the database instead of the flat files that they currently are.
However, I'm not 100% on that.
Thanks
Nik
Hey Nik,
I'm just having a dig in to this and I think setting up a scheduled task would be the most appropriate approach, but I'm still scratching my head about what to write within it.
I'm just taking a quick nosey into public methods of the DLL's and can see that the Umbraco Forms front end calls the Delete(Record record, Form form) method of the RecordService class within the Umbraco.Forms.Core.Services namespace. I just need to track down how to query the API to get the Record and Form objects.
If I happen to strike it lucky and figure this out I'll post my findings!
Regards,
Andy
Hey Andy,
In v7 I did something like this:
And then this for the delete:
You could add filtering into that get aged results.
I assume the services etc would be similar/the same in v8
Thanks
Nik
Awesome cheers Nik, I'll keep this thread posted of any solutions I may find.
is working on a reply...