Changes to WFFM Save Actions in Sitecore 8.1

When Sitecore 8.1 was released back in October, it brought with it many wonderful, new, exciting features, enhancements and welcome bug fixes!  Amongst all of this awesomeness, however, was a handful of breaking changes.  I found one of those breaking changes while I was working on the code for my post on Syncing data from Dynamics CRM, directly to xDB.

Until Sitecore 8.1, and subsequently WFFM 8.1, you could create a custom save action like so:

public class My80CustomSaveAction : ISaveAction
  public virtual void Execute(ID formid, AdaptedResultList fields, object[] data)
     //Do some work here

Then, in the Content Editor, you would create a new Save Action under

/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions

save action

However, while talking with Adam Conn (@adc_sitecoreover in the community forums about an issue I was having with the CRM Campaign Integration module, I found out that one of the many breaking changes introduced with 8.1 was that the method signature for Execute on ISaveAction had changed.  In that particular instance, the save actions provided by the CRM Campaign Integration module for creating CRM Contacts and Entities had not been updated.  It also affected all of the save actions I had created to that point as well.

While throwing together a quick POC, based on a debate being had on Slack about GlassMapper, ViewModels and what exactly gets returned from a Controller and why, I was reminded of this change and that I had intended to blog about it.

Creating a save action in 8.1 now looks like this:

public class My81CustomSaveAction : ISaveAction
  public override void Execute(ID formId, AdaptedResultList adaptedFields, ActionCallContext actionCallContext = null, params object[] data)
     //Do some work

Configuring the Save Action in Sitecore is the same, but notice that a parameter was added to the Execute method –

ActionCallContext actionCallContext = null

In order to support CMS-Only mode, as well as re-introduce saving form data to SQL, much of the code for WFFM was refactored out of Sitecore.Forms.Core into Sitecore.WFFM.Abstractions.

Happy Sitecore trails, my friends!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: