HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Implement actors

Explains the use of actors and how to configure them.



Optimizely Forms is only supported by MVC-based websites and HTML5-compliant browsers.

Optimizely Forms actors

After a visitor submits a form, Forms.Core calls actors to perform additional processing on the server.

  • You can extend and plug in the actor, and a third-party developer can implement it.
  • You can run Actors in a sync or async manner.
  • Each actor is provided with several data, including SubmissionData and the HttpRequest.
  • Sync-actor can have (and can modify) the HttpResponse, so the actor can modify the response and cookie before returning the result to a visitor's browser.

By default, Optimizely Forms has two built-in Actors:

  • CallWebhookAfterSubmissionActor
  • SendEmailAfterSubmissionActor

Handle submission actor's result

From version 4.16.0, you can let actors:

  • Return a signal to cancel a form submission when an actor fails.
  • Return an error message to be displayed to visitors.

To be able to cancel form submissions and to display error messages, you need to implement the following changes:

  1. Actors must implement ISyncOrderedSubmissionActor. Actors implementing this interface run synchronously in ascending order, regardless of the IsSyncedWithSubmissionProcess value. (Actors are forced to run synchronously because you cannot control the result of async actors).
  2. Actors must return an object instance of a class that implements EPiServer.Forms.Core.PostSubmissionActor.Internal.ISubmissionActorResult.
    By implementing this interface, the returned result will have two properties:
    - CancelSubmit (boolean): determines whether the form submission should be canceled.
    - ErrorMessage (string): this error message is displayed to visitors.

Implement customized actors

Third-party developers can implement their actor by:

  • Inheriting a PostSubmissionActorBase base class.
  • Starting from scratch with the IPostSubmissionActor interface and interface IUIPropertyCustomCollection for edit view user interface of configuring the Actor model.

See the sample code for implementing an actor in the open-source project on GitHub.