EpiServer Forms

Vote:
 

Just wondering if it is possible to call an episerver form directly through code? I've added an additional property to the product where it accepts an Episerver form but was thinking that it would be tedious to repeatedly drag and drop the form into each product (will be adding the form into all products). Can someone guide me to how to call a certain form/block (was also thinking that Form Container is a block)

#259512
Edited, Jul 27, 2021 4:00
Vote:
 

Content, Products and most things are just IContent items, therefore you can use the IContentRepository to programtically create/edit them such as adding a form reference to a page/product.

Here's some examples of working with it

https://labs.tadigital.com/index.php/2017/12/07/programatically-creating-and-updating-pages-and-blocks-in-episerver/ 

https://www.aperturelabs.biz/blog/creating-episerver-forms-via-the-api/ 

https://world.optimizely.com/documentation/developer-guides/CMS/Content/Creating-a-page-programmatically/ 

But there's plenty of articles / blogs out there but they are all pretty much the same use

#259515
Jul 27, 2021 8:26
Vote:
 

Hi Scott! Yeah, that worked! Was actually using a wrong approach that's why it keeps giving me null. Thank you!

#259560
Jul 28, 2021 7:25
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.