Wednesday, April 18, 2018

Kentico EMS - Enable bulk delete of form data

With GDPR right around the corner many of our clients are reviewing what data they have in their Kentico installation. One of the primary areas of concern is data collected through online forms.

GDPR and Kentico Online Forms

Kentico has a quite powerful online forms, making it easy to ask for input from your visitors. Unfortunately, privacy regulations including GDPR and it's predecessors state clearly that you cannot keep that data around after you're done processing it.

In addition to that, the best way to ensure data doesn't get stolen or leaked is not to have it in the first place.

Kentico does not make it particularly easy to manage high volumes of form input though. One of the glaring omissions is support for bulk deletion of form data.

The power of the UniGrid

Funny enough though, Kentico's data grids and data layer do support bulk delete out of the box. It's a matter of tuning the grid that shows the form data. The Kentico data grid is backed by the UniGrid control. In the case of form data, this control is defined in

CMS\CMSModules\BizForms\Controls\BizFormEditData.ascx

All that is needed to enable the mass delete action:

<cms:unigrid runat="server" id="gridData" islivesite="false" >
    ...
    <GridOptions DisplayFilter="true" />
    <%-- insert the following tag --%>
    <GridMassActions>
        <ug:MassAction Name="#delete" Caption="$General.Delete$" Behavior="openmodal" />
    </GridMassActions>
</cms:unigrid>

After this change, the form data grid will show a selection field as the first column and the delete action is available at the bottom of the grid.

Further reading

If you want to know more about the powers of the Kentico UniGrid, check the docs.