Episerver forms - Adding custom placeholder to placeholder dropdown



I need to add a placeholder option by code without creating a new element in the form container to the "Insert placeholder" functionallity that is used when composing emails in Episerver forms.

Whats the best way to go about this?

I have tried overriding 


I did this by creating a class that inherits from placeholdermanager and using the attribute below

[ServiceConfiguration(Lifecycle = ServiceInstanceScope.Singleton, ServiceType = typeof (IPlaceHolderManager))]

I also tried creating a [InitializableModule] that configures the IPlaceHolderManager interface to use my implementation of the PlaceHolderManager class. This works as i can stop my code and see that my implementation of the PlaceHolderManager is used. Yet no new options from my GetPredefinedPlaceHolderKeys() method.

Any help is much appreciated! :) 

Sep 27, 2016 16:26

Hi Jonas! Im working with this problem aswell. Did you have any luck?

Nov 18, 2016 14:29

Hi, sorry for this late.

As described in the class comment, The PlaceHolder API is a pre-release API that is UNSTABLE (of API functions signature) and might not satisfy the compatibility requirements as denoted by its associated normal version.

It is considered as internally. This is the first time I have 2 questions about it.

So, please raise your need, elaborate your real usecase. We will try the best to make it stable in next release! (in 4.3 I think). I started a story  for it.

Edited, Nov 22, 2016 12:14

@THACH Lockevn

Thank you for your response. I have solved my problem with a different approach, Its good to know the API will be useful in a future version if i encounter the same task again :)


My problem was to add pageID of the page that sent the form as a placeholder. I solved this by code adding a hidden predefined element block on each new form created named PageID.

To recieve the pageID value for the hidden element block placeholder when a mail is sent i override the GetFormSubmissionActors in ActorsExecutingService and simply replace #PageID# with the value i want in the emailModel body.

This left me with the problem that when i export forms or view submissions in my forms mode a empty field named PageID lingers there.. lucky for me my client wanted the pageID in the exported forms and submissions aswell. But if you can hide the field somehow or maybe not save it to database on a submit then you should be all good.

Heads up tho i tried this quickly and it didnt find a solution instantly so it might require some digging :)

Nov 22, 2016 12:52

Update, Forms 4.3 have PlaceHolder API as BETA, and I think you can start using it.

More information is here http://world.episerver.com/documentation/developer-guides/forms/placeholder-api/

Edited, Jan 23, 2017 5:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.