Insights

Creating Dynamic Packages With Sitecore Package Designer

What Is A Package Designer?

Package Designer is used to create packages with Sitecore items that can be easily transferred, for example from one Sitecore website to another. Whether you need to copy just one or two items from one Sitecore instance to another, or you need to perform a mass data migration - content packages can come in handy.

Packages that you create with the Package Designer can also contain security accounts.

Packages can be created in two ways

  1. Static
  2. Dynamic

Static Package

The static package can be used when you want to include all the items or files that are stored under a specific node or folder in the content tree or if you only want to include a few specific items or files but let's assume that you want to add items or files based on creation date query? In that case, we use the Dynamic package.

Dynamic Package

The dynamic package can be used when the items or files that you want to include cannot be easily selected, for example, if you want to include everything created after a certain date.

Step 1

To create a package, Login to your Sitecore account, click on Desktop and start up Package Designer from the Development Tools.

Sitecore > Login > Desktop > Development Tools > Package Designer

Create a Package from the Sitecore Development Tools menu

Step 2

Select items dynamically; then you can see a window where you need to select the database and root item from a Sitecore content tree

Step 3

After clicking select you can apply any of the following filters

Item Name Filter

All or part of the item name: Filter items by name or by a part of the name.

Use: Select a lookup option. The lookup options are below

Simple Search Simple substring search, no wildcards, not case sensitive.

Regular Expression Common regular expressions and regular .NET expressions are allowed. For more information about regular .NET expressions, read the official Microsoft documentation.

Wildcards Common wildcards are allowed. A question mark (?) stands for a single character. An asterisk (*) stands for any number of characters. Any other character is matched as is. Search is not case-sensitive.

Creation Date Filter

Within the past .. days: Filters items by the date they were created. Note Within the past XX days function is just a UI convenience; this is not a floating date. When a user enters a number of days, this value is converted to a static date range.

Specify dates: Filters items by the date they were created.

Modification Date Filter

Within the past .. days: Filters items by the date they were modified. Note Within the past XX days function is just a UI convenience; this is not a floating date. When a user enters a number of days, this value is converted to a static date range.

Specify dates: Filters items by the date they were modified.

Publish Date Filter

Publish date: Includes only those items which are publishable on a specific date. You will get only those items from the source, which appears on the web database if you perform republishing on the Publish date.

Take workflow into account: Select the Take workflow into account checkbox if you want to apply workflow restrictions to publishing when filtering.

Template filter: Filters items by templates that the items are based on. Only the items which are based on at least one of the templates from the list are added.

Created by filter: Filters items by users who created them and/or by the roles which the users who created the items belong to. Click Add to display the list of users or roles and add them to the filter.

Updated by filter: This filter works in a similar way as Created by Filter one. It filters by users who updated an item last and/or by roles which those users belong to.

Language Filter: Select the checkboxes you want to make only the items in the selected languages added.

As you can see from the following screenshots:

First step in specifying source filters when creating your dynamic package in Sitecore

Second step in specifying source filters when creating your dynamic package in Sitecore

Third step in specifying source filters when creating your dynamic package in Sitecore

Step 4

Add the filters you need and click next

Step 5

Enter the source name and now you can generate your package.

Important note: If you use more than one filter at the same time, they will be combined using logical AND. If you want to achieve a logical OR effect, you need to create two packages with the same search root item but with a different filter. So, you will do two separate exports, one for newly created items and one for recently modified items. The union of two generated content packages create the logical OR effect that we wanted to achieve. And then you will do two imports into target instance.

If some of your items are included in both packages (because newly created items will also have the update date from the same period) you will be asked to resolve a conflict during import - the import process will ask you what to do. In that case, it’s best to choose Merge - Merge option in the dialog that appears.

For example, if you want to export items that have been created OR modified within the past 3 days, you would create two packages with the same search root item, but one would have a condition Created within the past 3 days and the other would have a condition Modified within the past 3 days. If both conditions were combined in one source they would produce the condition Created AND modified within the past 3 days, and that’s not what we wanted to achieve.

Hey, Developers!

We're on the look out for talented developers to join our team.

Think you have what it takes?