Monday, June 15, 2009

Why use "dynamic" sources in the packager?

Here's a little bit of advice that many people may not be aware of:
  • Use dynamic sources whenever possible when you create Sitecore packages.
If you're like me, your first instinct is to use static sources ("add items statically..." or "add files statically..."). That's because it seems easier to choose which items or files to add. It turns out, however, that dynamic sources, while a little harder to create, offer one great advantage; when you create a new package "From Existing...", the package new package will "re-run" the dynamic query to choose items. To understand the difference, consider this case:
  1. You create a package with all items under the "Home" item in the package.
  2. Install the package on a clean site.
  3. Delete most of the items and create a bunch of new items under Home.
  4. Create a new package "From Existing..." (an option in the New drop down menu).
    • If, in step 1 you used "static" sources, the new package will NOT include the new items under Home.
    • If, in step 1 you used "dynamic" sources, the new package will include the new items under Home.
Thus, using dynamic sources allows you to recreate a new package when you've made lots of changes very easily, where as you almost need to start from scratch with static sources. Hope this helps a few people out there!