Insights

The Dark Side of TDS Deploy Items Changed After (IncludeItemsChangedAfter)

Or, why your build might be broken.

TDS settings support functionality that exclude items from deployment if they are “stale”. Depending on how far in the past your team has this value set to, in some cases it can be very likely that you created items long enough ago that TDS will not deploy them.

<IncludeItemsChangedAfter>$([System.DateTime]::Now.AddDays(-120).ToString("yyyy-MM-dd"))</IncludeItemsChangedAfter>

One major problem with this is that it can break your build because of orphaned items (items without parents — Bruce Wayne items). For example, if a template doesn’t get deployed but the standard values of that template do get deployed, TDS will conk out. In your build log it will mention that the parent item has not been deployed because it’s not a deployable item. You'll get an error message like this:

[13:52:04][Step 1/1] Skipped deployment of /sitecore/templates/user defined/template name because it is not a deployable item.

[13:52:04][Step 1/1] sitecore\templates\User Defined\Template Name\__Standard Values.item(1-2): TDSError error TDS0005: Deploy of /sitecore/templates/user defined/template name/__standard values failed. Reason: Exception of type 'Sitecore.Data.Serialization.Exceptions.ParentItemNotFoundException' was thrown. [D:\sitecore-trunk-alt\TDS.Project\TDS.Project.scproj]

You might be thinking that the solution is simple:

  1. Allow for older items to be deployed. Yes, but then you run the risk of deploying old items that shouldn’t be deployed. Proceed with caution.

  2. Just update the “Updated” date field on the items in question. Sure. Unless you have hundreds or thousands of items, or items with multiple versions and languages. Database context matters too. It’s worth being mindful about. This becomes particularly relevant when you’re actually making the updates. You may think you’re updating the field successfully when in fact you may not be.

For this case we decided to update the dates programatically. However, the code didn’t execute as straightforwardly as expected. One example is that the field name for “Updated” is actually “__Updated” (which can be determined by opening up the item in a text editor), despite the field name being displayed as “Updated” in the content editor.

Once you’ve made the changes, your TDS sync window may not pick them up. If so, you will have to change your local TDS options for the sync window not to ignore changes to fields such as the Updated date. At that point you should be able to actually sync the changes.

Good luck out there,

Marcel

👋 Hey Sitecore Enthusiasts!

Sign up to our bi-weekly newsletter for a bite-sized curation of valuable insight from the Sitecore community.

What’s in it for you?

  • Stay up-to-date with the latest Sitecore news
  • New to Sitecore? Learn tips and tricks to help you navigate this powerful tool
  • Sitecore pro? Expand your skill set and discover troubleshooting tips
  • Browse open careers and opportunities
  • Get a chance to be featured in upcoming editions
  • Learn our secret handshake
  • And more!
Sitecore Snack a newsletter by Fishtank Consulting