Sunday, 17 September 2017

WFFM : Customizing SQL form data provider

Requirement

I’ve got a task where I have to save user’s browser information (Browser name and version) into Sitecore WFFM SQL database as part of the every WFFM form submission. Website support team would like to know the user’s browser that is being used for accessing the production site, so that they don't have to request this information while troubleshooting any issues the user has reported via the Feedback/Troubleshooting Contact Us form.

Environment Details

Implementation

I’ve decided to customize WFFM save to database functionality and add new FieldData to form field list dynamically while saving form data. This new FieldData will consist user’s browser information (Browser name and version). This implementation can be achieved by below three ways:

WFFM Configuration

In the \Website\Data folder of your Sitecore instance, attach the Sitecore_Wffm.mdf database to the SQL Server, and add a connection string with the name “wffm” in the ConnectionStrings.config file, located in the \Website\App_Config folder.

Update:

After publishing this blog post, I had a nice fruitful conversation with Sitecore MVP Kamruz Jaman regarding this implementation. If you are not already using custom SQL provider in your solution then prefer to create a custom field to handle above scenario. Nevertheless, this WFFM blog post series will give you fair idea about how to customize SQL form data provider and export form data to excel functionality.