1

Is there any way for creating a simple form in Sitecore through dynamically using code so that it appears in the Sitecore Forms UI?

Any suggestion appreciated.

3
  • Please add more details into your question. You want to have code that's generates form using Sitecore forms and then it appears in Sitecore Forms UI? Is this correct? Why you would like to create form dynamically using code? Nov 13, 2018 at 12:35
  • yes your correct..
    – user4124
    Nov 13, 2018 at 12:38
  • You want to have code that's generates form using Sitecore forms--exactly i want
    – user4124
    Nov 13, 2018 at 12:38

1 Answer 1

3

Though, I don't see the use case for your question, a form is just contructed by a tree of sitecore items. So in theory, you could create those items through code, like you would create other sitecore items with the Sitecore API.

enter image description here

To make it appear in the Forms UI, you would need to index them to the master index, as the list is builded from the master index.

If you would like to see the structure of the items you need to create, I would suggest to create a sample form through the UI, and get a look at the created items.

8
  • I want to migrate WFFM to Sitecore forms,if they used textbox i need to convert into Sitecore 9 forms textbox via code.So just i need to create a items like as usual in sitecore..is this creates a form?
    – user4124
    Nov 13, 2018 at 12:47
  • 1
    A noble cause to create a converter tool. :-) Good luck, but I think it will be challenging because there are major differences in architecture and functionality between WFFM and Sitecore Forms. Nov 13, 2018 at 12:50
  • okay.Thanks for your info and reply Bart..!
    – user4124
    Nov 13, 2018 at 12:53
  • It might be easier to actually just have a person migrate the forms from one form to another. Unless you have 10,000 forms or some other ridiculous number of them. Nov 13, 2018 at 15:01
  • Sitecore Powershell Extensions are your friend here - marketplace.sitecore.net/en/Modules/… Nov 13, 2018 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.