Site icon @WonderLaura

Using Content Types as Statuses

Today I’m going to show an interesting way that you can use SharePoint content types.  First, I’ll show you what the end result looks like, which will help explain the concept of using content types as statuses.

This solution was originally created for SharePoint 2007, but can also be used the same way in SharePoint 2010 and SharePoint Online with Office 365.

Statuses?  I’m referring to a field in any kind of list, that is used to indicate the status level of a list item, such as a Task list.  There is a built in field in a task list that contains a field called status, with levels like In Progress, Completed, etc.  In this example, we have a patient admissions system as a SharePoint list.  There are three different stages that a patient goes through in this list.  They’re admitted, then they’re considered a current patient, and then they’re discharged from the hospital.

A requirement of this example patient list, is that for each “status level”, there are different fields that need to be filled out in the form.  This is where content types can be quite useful.  Here are screenshots of the end result of this example.  Notice the “Content Type” drop-down box on each one, and the fields in each form… they’re different.

43-image_82e93ce8c884429f82dc1063b8441d90_0094DF57.png

 

Notice that not only are the displayed fields different, but the required fields are also different at every step.  This is all done using out of the box functionality in WSS or MOSS, and here’s how:

First, in planning, put together a spreadsheet that defines the list of all the fields (columns) that will exist in the SharePoint list, so that it can be determined which field needs to be in each status as “Optional”, “Required” or “Hidden”.  It will look something like this (for time’s sake, I’m only entering four fields):

FIELD

Admission

Current Patient

Discharge

Admit Date

Required

Optional

Hidden

Case Manager

Optional

Optional

Optional

Discharge Date

Hidden

Optional

Required

Discharge To

Hidden

Hidden

Required

In the chart above, you can see that depending on what’s going on with the patient, certain fields are required or hidden.  Here’s how to go about setting this type of list up on your site once the planning has been done.  As I go through these steps, I’d like to point out that I’ve been through and messed up this process many many many times, and some of these steps need to be done in a certain order, or it can just end up getting hosed up and can be extremely time consuming.

Note that these next steps where we create the site columns and content types can be done in different order.  Create all the site columns first or the content types first.  I’m just choosing to create the content types first here.

  1. A “master” content type is created first.  In Site Settings and go to Site Content types.  Click the <Create> button.  Name it something appropriate.  In this case I called it “Case Mgmt All”.
  2. Since ultimately the type of list I’ll be using for this will just be a custom list, I’m going to pick “List Content Types” and Item as the parent for this first one, and I’m choosing to create a new group, which is just how it’s listed on the page with all the other content types:
  3. Next, create each of the other status levels as content types.  I chose to put numbers (1-3) in front of the names of each of mine, just so they’d be displayed in that order.  Click the create button for the next one.  Pick the parent type that was just created, as the parent, and for the group, choose the existing group (that was entered as a new group in step 2):
  4. Repeat step 3 for each of the other status level content types, with the only difference being their names and descriptions.  They should all use that first content type as the parent.
  5. The next step is to create a bunch of site columns to associate with the new content types.  On the Site Settings page, click Site Columns.  Click Create.  This is all pretty standard.  For the first one, choose to create a new group called Case Mgmt.  (we created the group in the content type gallery, and now we’re creating on in the site columns gallery.)  Fields that will end up being set as required in all content types can be set as required on this screen also.
  6. Just create all the rest of the columns, just as you would normally, just try and remember to pick your new grouping for each one.
  7. Next is the fun (and sometimes tedious) part, where the site columns are put into content types.  Go back to Site Settings and Site Content Types.  Click on the name of the parent content type first.  In this one, I called it Case Mgmt All.
  8. Click “Add from existing site columns”
  9. From the drop-down box, select the name of the column grouping that was created in step five, which will filter the list by only the pertinent columns.  If you missed one or two, and forgot to place them in the new grouping when they were created, they won’t show here (I’ve done this many times)  😉
    Select all of the column names on the left, and click to ADD them to the right and click OK.
  10. Now, notice that when back in the site gallery, as you look through each of your different status content types, they will each contain ALL of the fields that were just added to the parent!
    <golf clap>
    The next step is to go through each of the fields in each of the child content types, and change the ones that have to be required or hidden.  I don’t recommend messing with the Title field at all here, or even changing the name of it.  Not worth the hassle, we’ll do that later, but just keep in mind what it should be called.  In this case, it’s “Patient Name”.
  11. If the columns need to be re-ordered, I recommend doing it at the parent content type level first, and the children will inherit that order.  After that, the children can still be re-ordered individually.
  12. Just to clarify… Click on the first child content type, in this case it’s “Admissions”.  Click on a field that should be set as required, and change it to Required, as so.  Do this throughout all content types, for the required fields:
    Note that fields can be set as required in the parent content type also, which will force that field to be required in all of the children.

  13. For the fields that can be hidden from each content type, they can be Removed from those children.  Do NOT remove any fields from the parent, as it will then be removed from all the children, and do not set any of the parent’s columns to hidden, either. So, look back at that original table you created, and for each of the ones that can be hidden in each content type, you can click the Remove button.  I’ll show you a benefit of that compared to simply changing them to “Hidden”… in a minute.
  14. In the Content type gallery, now when I click on my first content type called “1 Admissions”, this is what the screen looks like.  Notice that a couple of the columns are required, and several have been removed.
  15. Now it is time to create a new SharePoint list to put these content types in.  For mine, I create a new custom list on the site, called “Patient List”.
  16. In the list’s settings, go to Advanced Settings, and under “Allow management of Content Types”, change it to Yes.
  17. In the Content Types section on the List Settings page, click “Add from existing site content types”.  In the drop-down, pick that custom content type grouping you created in step 2, to filter the list.  Select ONLY the one parent content type and click Add and click OK.
  18. Since this is a custom list I’m using, the default content type that was already in my list, is called “Item”.  Click the name of the item content type, and click “Delete this content type”.
  19. Now the other, child content types can be added to the list.  Click “Add from existing site content types”, choose your custom group in the drop-down, and then select all the rest of the content types and add them. Click OK.
  20. Go ahead and rename the Title field to something else if need be, here at the list settings level.  Optional.
  21. Notice something cool in the list settings now.  Next to each column name is a list of all of the content types that it exists in!  In step 13 when I mentioned that removing the columns was better than hiding them, this is why.  When they’re only set to hidden, then every content type shows up next to every field in this screen, and there isn’t a quick way to be able to see what lives where.
  22. Next, it’s time to just make sure that the different status levels show in the desired order in the form.  Still on the list settings screen, click “Change new button order and default content type”.  Order the “statuses” as desired.  If you uncheck any of them here, they will not only be hidden from the New drop-down button but also from within the edit form of any item.

All done.  Now when you create new items in the list, only the fields in the first content type will be available to fill out.  Then, you can edit an item and change the content type, to dynamically see the fields in the form change.  This solution isn’t going to be for everyone.  For example, you may not want the users to be able to switch between content types like that.  One thing I’ve done for that kind of situation, is to uncheck all but the first content type (in that last screenshot).  The, the content types are only changed via a workflow.  For example, once a certain check box is checked or field is filled out, then the content type is changed by the workflow.  then, the next time the users open the item, it will show the fields from that other content type.  Not sure how well I explained that last part… maybe I’ll have to write a whole other blog post for that.

Here’s an 8 minute video of this whole process:


Exit mobile version