Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Andy Boot 50 posts 192 karma points MVP
    Jun 07, 2021 @ 11:47
    Andy Boot
    0

    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

  • Nik 1617 posts 7263 karma points MVP 7x c-trib
    Jun 07, 2021 @ 11:54
    Nik
    0

    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:

    1. Umbraco forms API is slow when doing bulk processing
    2. Would be worth using a scheduled task / webjob to trigger the behaviour.

    Thanks

    Nik

  • Tiffany 11 posts 86 karma points MVP 4x c-trib
    Jun 07, 2021 @ 14:16
    Tiffany
    0

    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.

  • Nik 1617 posts 7263 karma points MVP 7x c-trib
    Jun 07, 2021 @ 15:12
    Nik
    1

    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

  • Andy Boot 50 posts 192 karma points MVP
    Jun 08, 2021 @ 09:05
    Andy Boot
    0

    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

  • Nik 1617 posts 7263 karma points MVP 7x c-trib
    Jun 08, 2021 @ 09:35
    Nik
    1

    Hey Andy,

    In v7 I did something like this:

    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

    Thanks

    Nik

  • Andy Boot 50 posts 192 karma points MVP
    Jun 08, 2021 @ 15:18
    Andy Boot
    0

    Awesome cheers Nik, I'll keep this thread posted of any solutions I may find.

Please Sign in or register to post replies

Write your reply to:

Draft