Default values on a content type not set in a page layout


Now this took me some time to figure out…

Basically the problem I was having was that some of my fields, specifically date time fields, weren’t being populated with their default values of [Today]. I had set the default value correctly on the field and assigned the field to my Content Type which I had then applied to my Pages library (all through a Feature). Everything looked fine until I created a page, and hey presto all my fields were empty.

I thought at first it was to do with how I was provisioning my fields in xml but everything appeared fine, I then added a date time field through the GUI with a default value to my content type to make sure and that didn’t work either!

I then started looking at the settings on my Pages library to see if anything there was wrong. I did have multiple Content Types assigned to my library so I thought to avoid confusion I’d remove all the other Content Types and leave mine as the default. I created a page and all my default values were populated!! Aha, I thought, there’s a conflict somewhere or a corrupt Content Type. So I added them all back in, testing after each one and everything worked!

After further testing, it turns out that default values on fields in a Content Type on a page layout will ONLY get populated on the DEFAULT Content Type on a library. Definitely seems to be a bug… and is a problem if your multiple content types each have fields with default values, luckily for me that wasn’t the case.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s