Dynamic forms using Content Types

Anything labeled out of the box conjures up the characteristics of being inflexible, overly simple, irrelevant and difficult to use. However, sometimes you just need to be pragmatic and creative in order to get things done and build on what is already available. In this post I discuss how content types can become this foundation for creativity with respect to dynamic fields.

In Microsoft InfoPath, it is quite easy to show/hide fields using Rules. But customers do not always have InfoPath as part of their configuration or application setup (it’s not about the cost, but a design choice). Then JavaScript is also an option, but I would not consider that a “safe” approach. It would also be a nightmare for the business to maintain JavaScript driven solutions, even possibly your average application support engineer as it becomes overly complex. The ease of use is there, but the maintainability is very poor. Moreover, in the latter case you would need to get the Content Query Web part of the SharePoint Server Publishing Feature activated on your site. Site owners can activate features, but if the feature is not enable on the farm level, very little can be done. Finally, best practices typically are to use third-party solutions like Nintex Form or K2 for instance. Third-party tools usually provide you with solutions for re-occuring issues that are not available out-of-box in SharePoint. Unfortunately, we don’t always have these options at our fingertips.

So recently I ran in such a situation where we needed some sort of dynamic forms. And content types turned out to be the solution. Now normally you wouldn’t exptect that. After all, Content Types are used for something completely else I would say. But Content types in SharePoint are really an important concept. At a basic level, they are a way to package pieces of metadata and make metadata collections reusable. For instance, let’s say you wanted three columns on every list or library in your site collection. Rather than go to each list and add each column manually, you can create a content type that has thos three columns and then add the content type to the list or libraries. This can be a significant time saver an provide substantial reuse benefits when you need to make changes to the content type.

Content Types however, can also add value in another way if you let your users really use them. For instance, when you upload a document to a library where you have multiple Content Types enabled, the user is always asked to pick a content type. They will get a different form based on the type of article, request or whatever they want to create. The challenge you then come across, is that when users click on “new item”, they get the default content type and are not allowed to select which one they need. However, if users go to edit the item after creating it then they can change the content type from a drop down menu. As such, when you click on the New button, more options appear in the dropdown allowing you to select a content type and this then sort of gets you dynamic forms and allows you to help navigate users.

The good thing is there’s also a way to activate the Content Type drop down as soon as they click “new item”. What I discovered is that. The simplest and most common way to handle this would be to hide the Add New Item link altogether on the List View by setting the toolbar type to “None”. This would force users to use the ribbon.You would of course need to educate the users and let them know about the dropdown options. But it’s a quick win and pragmatic and creative solution that can be achieved exploiting standard functionality.

Leave a Reply

Your email address will not be published. Required fields are marked *