Creating Forms via API

Vote:
 

To help simplify the initial deployment of a site, I'm trying to automate the process of creating a few forms.  I'm finding this process to be rather tedious, and am hoping there is an easier solution.

From what I've read in the documentation (which is extremely limited) and some blog/forum posts, forms are based on the concept of blocks, and can be created as such via IContentRepository.  So long as I put these new instances of FormContainerBlock where Forms is expecting them (ContentReference.GlobalBlockFolder -> "Episerver Forms"), it seems to work as expected.  However, adding fields to the form appears to require creating instances of the FormElement blocks I need (text, number, etc.), and putting them in the "For this block" folder (at least, that appears to be what Forms does out of the box).  I haven't tested this fully yet, but I don't see any reason why it wouldn't work.

Is there a better way to accomplish what I'm trying to do?  It's been basically "guess an check" so far, which is unfortunate and time consuming.  I see the IFormRepository and IFormDataRepository, but they offer very limited funcitonality related to retrieving data from forms/submissions.  If it doesn't already exist, I think having a proper API for interacting with Forms would be very helpful.

Alsothere doesn't appear to be any real "developer documentation" for Forms.  Is this something that is on the roadmap?  Having to dig through source code and random forum posts isn't a very productive way to work...

#190198
Apr 04, 2018 17:35
Vote:
 

Hi Patrick,

The documentation is here: https://world.episerver.com/documentation/developer-guides/forms/

I don't know any other better way to accomplish that. And i ve never build forms from code.

My favorite regarding retrieving data from submission is through webhooks https://world.episerver.com/documentation/developer-guides/forms/implementing-a-customized-actor/webhooks-actor/

but you do also have the service api https://world.episerver.com/documentation/developer-guides/forms/using-forms-serviceapi/

Ive also blogged randomly about forms http://devblog.gosso.se/tag/episerver.forms/

Good luck!

Luc Gosso

#190199
Apr 04, 2018 18:28
Vote:
 

Thanks for the reply.  I had seen that documentation link already, but it doesn't cover much as far as interacting with data (and even less about how to create instances of forms via the API).  I guess I will continue on the path I was on.  I was hoping I was missing a built-in API for creating forms...but I guess not.

#190201
Edited, Apr 04, 2018 18:33
Vote:
 

For anyone else that may need this in the future, I finally got around to doing a write-up on using the API to create froms.

#195204
Jul 17, 2018 16:28
Vote:
 

Patrick,
This is a great blog post. Would you be willing to share it on Epi World under Blogs?  See https://world.episerver.com/System/Blog-info/Episerver-World-Blog-Rules/.

#195251
Jul 18, 2018 16:52
Vote:
 

I finally got around to setting up blog syndication, but I'm not sure it's working correctly.  My Epi blog is here, but there's no content.  I'll keep playing with the settings a little and see if I can get it working.

#195867
Aug 09, 2018 17:08
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.