Starter kit for building data integrations or content migrations.
In the event that you need to authenticate to a site prior to being able to call for data, you can leverage this method. The recommendation is to use $PSDefaultParameterValues
to automatically append any necessary headers or other data onto your outbound calls.
- Web Service - URL to call to retrieve data
- Flat File - Path to the file
- Sql Query - Connection String to source database
Information is retrieved and stored in the $sourceItems
object, to be used in later methods
If the data you are retrieving is paged, such as in a REST API, you can tell the import how to get to the next page. The expression should evaluate to another url for the import process to call.
Example: if ($sourceItems.links.next) { $sourceItems.links.next }
$sourceItems
is expected to be an array of objects. If you have anything different, you can use an expression here to massage it into the appropriate format.
Select the template to use for creating the new item
Provide an expression to use for assigning an Item ID to the new item. This can be useful if you are imported relational data from another system, such as in content migration scenarios.
Provide an expression to use for assigning the Item Name.
New-ItemName
is included as a module method; this method will take the passed in value, and sanitize it for Sitecore naming requirements.
Provide an expession to use for the Display Name of the item. This is useful for multi-lingual imports
Map template fields to values in the source data. Each field mapping can be its own expression, or can reference a method for more complex mappings.
Spaces in the field names are supported via underscores (Example: Navigation Title --> Navigation_Title)
Used in conjunction with Item Sync Field
to determine if existing items should be overwritten or skipped
Used to determine if the item being imported already exists within Sitecore
For any additional processing that may be required during the item import, you can provide an expression here. It is recommended that the extra processors be written as methods, and added to the Custom Functions folder.
You can provided an expression to use for determining the language of the imported item. The process will use the Item Sync Field to determine if the item already exists in the en
language. If the item does not exist, it is created and then a separate version of the item is created in the given language.
Based path for the imported items
Used on conjunction with the Destination Path
to determine where the imported item should live in the content tree. The resulting expression should return a path, which is then appended to the base path to build the final path for the imported item.
Any extra work that needs to be done post process for the script.
The scripting section is delivered with the necessary expressions for executing the imports. If you are leveraging any custom or included methods in any of the above fields, the you will need to add those methods to list of imported methods (see screenshot).
The Data Sync execution links can be found in the PowerShell Toolbox.
If you choose to run the "Data Sync - All" command, then it will process all import scripts defined in the module.
If you choose to run the "Data Sync - Single" command, then you will be prompted to choose your import?:
In either case, when the import is complete, you are presenting with information on the content that was imported. This information will also include some helpful metrics detailing counts for new and updated items, as well as total run time.
- Check out the article written by Aaron Bickle.