Hide built-in actors of Episerver Forms

lockevn
2 min readJun 21, 2017

--

By default, Episerver Forms provides 2 actors: Email and WebHook. In some rare case, you might want to customize theirs business.

Email and Webhook actors are easily to extends, and you can easily implement your own CustomizedEmailActor : EmailActor, but both built-in EmailActor and your new CustomizedEmailActor appear in the Setting tab of the form.

Here is the flow of how Episerver Forms do it, and how you can hide the built-in actor, and only show your new Customized-one.

EPiServer.Forms.EditView.InitializationModule
has SetupFormContainerProperties()

It gets all actor-Types, derived from IPostSubmissionActor
having “AvailableInEditView” = true

Then it modifies the FormContainer ContentType, add a property to hold setting (model) of each working actor. By default, each formContainer has 2 properties (one for EmailActor and one for WebHookActor)

```
// scan content types, scan its properties, modify the property we want
var containerTypes = typeof(IFormContainerBlock).GetDerivedTypes();
// Name of the property is actor name
var name = actorType.Name;
CreateUpdatePropertyDefinition(formContainerContentType, name,
LocalizationService.GetString(string.Format(“/episerver/forms/submissionactors/{0}/displayname”, actorType.FullName)),
(Type)actorType.GetPropertyValue(“PropertyType”),
SystemTabNames.Settings,
-5000 — order * 100);
order++;
```

Actors store their working data (consider as input for Run() function) in these properties

You can totally hide built-in actor by modifying the ContainerBlock content type, edit the property related to the actor you want to hide, and un-check “Display in Edit View”

Uncheck “Display in Edit view” to hide the Actor

Though modifying contentType of Forms is not encouraged, this is safe to “hack”. WebHookActor and EmailActor grafully do nothing if you/editor do not configure it (in EditView/All Properties view of the form).

Here is the result, the built-in EmailActor is hide.

--

--

lockevn
lockevn

Written by lockevn

Developer, Sportman. Write code with joy, bake app with heart. Opinions are my own. If you feel I save your time, go http://BuyMeACoff.ee/Lockevn

No responses yet