Custom Form Editor in Web Form For Marketer | Sitecore

Some time we encounter situation where we are using WFFM to create form but because of custom requirement we don’t want to use Sitecore in-built send mail action instead we want to write our own custom action.
In-built Send Email action editor GUI looks like below -


Figure – 1

We want to update this GUI so that we can hide To, CC, BCC fields because we are not using these fields. Its always good to hide extra fields so that content editor will not get confuse. Now how can we do that? Answer is – follow below steps and you are all set:
1. There is an editor associated with inbuild send mail action. Sheet UI of this editor can be found at “website root\sitecore\shell\Applications\Modules\Web Forms for Marketers\Dialogs\Action Editor\SendEmail.xml” . UI of this editor is shown in fiture-1. First step is to create a copy this UI with name “CustomSendEmail.xml”
2. Open CustomSendEmail.xml file and change tag <SendMail.Editor> to <CustomSendEmail>


3. In CustomSendEmail.xml file addd visible =”false” in below tags. This will hide to, CC, BCC fields from editor


Please note – Right now we are only using existing editor code behind class that why we are only hiding controls not completely removing them from xml file. In next post I will explain you how you can create new class for editor

4. Now in Sitecore create a new custom action with name CustomSendEmail under /sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions. Update class name for custom action as shown in below image


5.Now update editor name in field “Editor” under section “Editor” with value “Control: CustomSendEmail”. As shown in below image


6. Save Custom save action item and you are all set.
7. Now assign CustomSendMail action to your form and UI of CustomSendMail will look like below.\



Creating a custom action is 2 step process -
1. Create a class under your project in visual studio
2. Create custom action under “/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions” and register custom action created in first step under it.