Tuesday, January 3, 2012

Sharepoint - custom dynamic forms with content types

There was a requirement for one of my client where we need to create a custom feature which includes the following:
1. Content Editor (Contributor) should be able to specify the content type what he / she wants in the UI with a list item entry (To define the target content type structure). (A source list which will hold the source form name and content type list name lookup column and a content type list with content type list name field, field name field, field type field, etc...)
2. In page display mode (not in page edit mode) Content Editor should be able to add a webpart to any existing webpart zone, which will have a "source form" property, which will be a drop down list displaying all the source form names from the list created as mentioned in Step 1.
3. In page display mode, user should be able to add data to the appropriate form and save. On clicking save, if the source form type list instance is not available, then a list instance is created and data is stored.

How am I going to approach this is a happy R&D:
Step 1. Content Editor (Contributor) should be able to specify the content type what he / she wants in the UI with a list item entry (To define the target content type structure). (A source list which will hold the source form name and content type list name lookup column and a content type list with content type list name field, field name field, field type field, etc...)

Create a content type with following definition:
If you dont know how to create content type visit these URLs
1. http://msdn.microsoft.com/en-us/library/ff630942.aspx
2. http://blogs.msdn.com/b/allenwang/archive/2010/09/08/how-to-create-custom-content-type-and-list-instance-in-sharepoint-2010-using-visual-studio-2010.aspx