Thursday, 8 September 2016

Error while using WFFM save action Send Email Campaign Message

Last time while I was playing with EXM and WFFM I have experienced strange issue. I am using Sitecore 8.1 Update-2, EXM 3.2.1 and WFFM 8.1 Update-2. I have added Send Email Campaign Message Save Action to my form, set up message and destination e-mail.

After form submit I got an error:

5276 15:43:58 INFO AUDIT (extranet\Anonymous): [WFFM] Form {B9C58542-7A02-4191-94B1-186C87EC74D9} is saving to db
5276 15:43:58 WARN [WFFM] Object reference not set to an instance of an object.
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Forms.Custom
at Sitecore.Form.Submit.SendStandardMessage.Send(AdaptedResultList fields)
at Sitecore.Forms.Core.Dependencies.DefaultImplActionExecutor.ExecuteSaving(ID formID, ControlResult[] fields, IActionDefinition[] actionDefinitions, Boolean simpleAdapt, ID sessionID)
5276 15:43:58 WARN [WFFM] The 'Send Email Campaign Message[id={EB59E095-5B61-4C04-8286-9469DAFD9A13}]' save action failed: We experienced a technical difficulty while processing your request. Your data may not have been correctly saved.
5276 15:43:58 WARN [WFFM] Web Forms for Marketers: an exception: We experienced a technical difficulty while processing your request. Your data may not have been correctly saved. has occured while trying to execute an action.

NullReferenceException was rather strange for me, so I started deep investigation. I have decompiled some WFFM and EXM classes and I found the problem. Some missing checks caused that issue.

The main cause of that situation is the EXM Message is being in state other than Active. Sitecore Support provided me with package, that solves this glitch.

Public reference number is 120449.

To resolve the issue, I had to:

Put the Sitecore.Support.120449.dll into bin folder

Navigate to the /sitecore/system/Modules/Web
Forms for Marketers/Settings/Actions/Save Actions/Send Email Campaign
Message item and perform the following changes with its fields: