WSS 3.0: Where are my custom fields in the new, edit and display forms of a list?
The Problem
Last week, I was doing a self study on WSS, SharePoint Designer 2007 and their relatives, for one of our internal requirements. With only a few customizations needed, there was one piece where WSS really got me mad. For our internal Project Management Office dashboard, we created a great WebPart thats pulls custom field values created in the Projects List. Creating Custom Fields are very straight forward and designing a DataViewWebPart (DVWP for short) in SharePoint Designer 2007 is much fun too. But then, the custom fields that I created did not make their way to the View/Edit forms of the list (DispForm.aspx and EditForm.aspx respectively).
I fired open SharePoint Designer 2007 only to find that the ListFormWebPart is rendered at runtime that it doesn’t allow you to edit from within SharePoint Designer 2007. That is disallowed at designed. Either have it embedded in there or delete it entirely. I was also not comfortable with using Custom List Web Part, as I expected SharePoint to detect the fields while I design it.
I wanted to test this behaviour for other lists as well. I added a new custom field and I was able to see my new custom field work in the display and edit pages for all other normal lists. But it didn’t make any sense on why custom fields don’t appear for “Projects List”. Where are my custom fields gone from the display, new and edit pages?
As I was also working on a few customizations to documents related to the project, spending a few hours on webcasts, articles, research and all the possible distractions, I found that “Content Types” were a pretty interesting concept. Only then i recollected seeing this term elsewhere. In one of my attempts to duplicate the frozen WebPart, I made use of what is known as the “Custom List Web Part” that asked for three inputs: 1) The List, 2) List Content Type and 3) an option group for new / edit / display.
Getting back to doing the same, I figured that “Project” was listed (the only item listed) in the Content Type drop down of that dialog. The question is where are these Content Types coming from.
The solution
OK, let’s jump right into the solution. To get your custom fields show up on some of the list that don’t behave as you expected in regards to the custom field, the first thing you need to check and conclude is the Content Type attached to this list. Content Types are site level columns definitions for consistent use in your lists throughout the site. They provide a great abstraction to enforce consistency in the field design of your lists and workflows.
To check and redefine the content type attached to your list, get to your list and do the following:
List Settings->Advanced Settings : Turn on Allow management of content types. (it’s turned off by default).
Click OK to get back to the list. You should now see the section: Content Types. In that section you should see at least one content type (in my case, it was “Project” as I was using a “Projects List"). Now this Content Type has a few column definitions and since this is the default content type for my list, the display, new and edit pages have dutifully obliged to restrict to only those column definitions. *Sigh*. Now go ahead and click to edit your content type and you should see options to add columns from existing column definitions. TADA! and your next screen should have all your great custom fields (or columns) ready to be added as part of this content type. If you do not like to tamper with the site wide content type, go ahead and create one, but remember, the new content type must manually be set as your default content type in order for display, new and edit pages to work.
Here is a good link I later found on this issue: http://office.microsoft.com/en-us/sharepointserver/HA101106061033.aspx
Hope this helps!
------ Other links ----
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.availablecontenttypes.aspx
andrew_may’s “SharePointBeta2WhatAreContentTypes”
cliffgreen’s sharepoint-webs-web-service-createcontenttype-and-updatecontenttype
http://msdn.microsoft.com/en-us/library/aa543576.aspx
http://msdn.microsoft.com/en-us/library/lists.lists.createcontenttype.aspx










Recent Comments