Why my custom submit action doesn’t work?

When creating a custom submit action in Sitecore Forms, all you need to do is to inherit the SubmitActionBase base class and override the Execute method, right? Wrong!

In this article, I want to share some gotchas when creating a custom submit action in the Sitecore Experience Forms.

Sitecore Forms, announced in the Sitecore Symposium 2017 and available at the Sitecore Experience Platform 9.0 Initial Release, comes with a completely redesigned UX that enables marketers and content authors to create forms from templates, create new forms by dragging and dropping Form elements such as textboxes, labels, lists, and etc. It promisses to completely replace the WFFM soon.

One of the features present in both WFFM and Experience Forms is the submit action (in WFFM they are called save actions) which are additional actions performed when a form is submitted. Altough, the Sitecore 9 – Update 1 brought a new submit action – Send Email Campaign Mesage – Experience Forms still lacks some very important submit actions that are present in the WFFM.

WFFM Sitecore Forms Comparison Updated
Figure 1: Submit Actions available on Sitecore Forms (left) and WFFM (right)

In the same manner WFFM enabled you to create custom save actions, Experience Forms also enables you to create custom submit actions. If you want to get started with custom submit actions please read the following walkthroughts:

When creating a custom submit action in the Sitecore Forms, you inherit the Sitecore.ExperienceForms.Processing.Actions.SubmitActionBase class.

Below is the definition of the SubmitActionBase class:

All you need to do (theoretically) is to override the Execute method, right? Wrong!

Recently, I was struggling with the code below. I couldn’t figure out what was wrong with it.

Whenever I clicked the submit button in my website, I would get the error message that you set in the Error Message field of the custom submit action.

Error message field.PNG
Figure 2: Error Message field

Investigating it a bit further, I found the reason why my code wasn’t working. It was because I was using the string type parameter in the SubmitActionBase, but wasn’t overriding the TryParse method.

where is the overrided
Figure 3: When using string type you need to override the TryParse

It doesn’t happen if you use strongly typed parameter in the SubmitActionBase class.

Why does it happen?

If you decompile the Sitecore.ExperienceForms.Processing.Actions.SubmitActionBase class you’ll notice some interesting things.

Figure 4: SubmitActionBase class decompiled

Where does the “parameters” in the ExecuteAction come from? It comes from the submit action item that was created throught the Experience Forms Editor when you add a submit button.

Figure 5: Parameters field

How to fix it?

Below I list three alternatives to work this around.

1. Use a strongly typed parameter in the SubmitActionBase (recommended)

2. Override the TryParse method (recommended)

3. Add parameters to your submit action
The problem with this approach is that you have to remember to fill the parameter field whenever you create a new form and add the submit action to a submit button.

parameters filled in.PNG
Figure 6: Parameters field with value

That’s all for today!

8 thoughts on “Why my custom submit action doesn’t work?

  1. Hmmm, this is weird, even if I am using a strongly typed model class to map the fields, I am still getting empty Guids in my Execute method. Could you explain how the mapping of the fields work on the background?


  2. Any idea why no matter what I do, my code won’t debug? I’ve written the custom action and in the form- model, i’ve set the Namespace ClassName. But no matter what I do, the debug point in the Execute Method will not get hit.
    It says No symbols were loaded. I’ve even manually copied the dll over to the website bin folder.


    1. Check if the build configuration is “Debug” and if the .pdb files are being published. Sometimes, publish profiles, if you are using msbuild publish, are set for “Release” mode by default


Leave a Reply to anthonyfernandes80 Cancel reply

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

WordPress.com Logo

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s