Sunday 17 September 2017

WFFM : Create custom Save to Database Action

Leave a Comment
In last blog post, I have explained how to create custom SQL provider to store form data into SQL database. If you’re interested to know the context of the customization, checkout the last blog post. In this blog post, I’ll explain how to create a custom save to database action.

Environment Detail

Sitecore 8.2 update 5 (CMS only mode), Web Forms for Marketers 8.2 rev. 170807


  1. Create a new SaveToDatabaseAction class and inherit WffmSaveAction class.
  2. Write custom logic to add new FieldData to form field list dynamically while saving form data.

  3. Build the code and deploy assembly in bin folder of your Sitecore instance.
  4. Navigate to Sitecore content tree and create a new Save To Database save action under /sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions node.
  5. Add a config patch to specify WFFM connection string.
    <configuration xmlns:patch="" xmlns:set="">
          <setting name="WFM.ConnectionString" value="wfm" set:value="wffm" />
  6. Select the relevant WFFM form and add Save To Database action in Save Actions.

  7.  Select the relevant WFFM form and in the Submit section, un-check Save Form Data To Storage checkbox so that form data won’t get saved multiple times into the SQL database.
  8. Publish Sitecore related changes.
In next blog post, I’ll explain how to customize export form data to excel functionality so that form reports include user’s browser information. Comments and suggestions are most welcome. Happy coding!


Post a Comment