Sitecore for Developers
SItecore Data Exchange Framework set up
Sitecore Data exchange framework is a standard tool for integrating the data with Sitecore and enables the Sitecore developers to import the data into the Sitecore system as Sitecore items. It is a tool where the developers extract the data from source system, Transforms the data into target system and loads the data into Sitecore. Sitecore release different versions of Data exchange framework systems which are supported in different Sitecore versions. For example, to use Data exchange framework 2.0, we need to have Sitecore 9.0 version or above. This blog is written based on Sitecore version 8.2 and Data Exchange Framework 1.4.1.Demo of Installing Sitecore Data exchange framework on sitecore 8.X instance.Download the Data Exchange Framework from https://dev.sitecore.net/Downloads/Data_Exchange_Framework/1x/Data_Exchange_Framework_1_4_1.aspx After installation, make sure the following folders show up on Sitecore tree
The first step is to add item with name ‘Location Data Exchange Tenant’ using template ‘/sitecore/templates/Data Exchange/Framework/Tenants/Data Exchange Tenant’ under /sitecore/system/Data Exchange folder.Note - Make sure to check enabled field in this itemNavigate to /sitecore/system/Data Exchange/Location Data Exchange Tenant/EndPoints/Providers/Sitecore and add Sitecore Item Model Repository Endpoint from folder options
Add Sitecore Item field value accessorsUsing template - /Data Exchange/Providers/Sitecore/Data Access/Value Accessor Sets/Sitecore Item Field Value Accessor Set and name item ‘Location Item Fields’ Under Location Item Fields , Add Item with name State Name using /sitecore/templates/Data Exchange/Providers/Sitecore/Data Access/Value Accessors/Sitecore Item Field Value Accessor
In the Item, Set ‘Field’ dropdown to ‘Templates/Sitecore/Feature/Location Data/Facility/StateName’ and save item.Create Item with Name ‘Value map sets’ using template ‘/Data Exchange/Framework/Folders/Value Mapping Sets Root’Create Item with name ‘Location Info Mapping Set’ using template /sitecore/templates/Data Exchange/Framework/Data Access/Mapping/Value Mapping Set.Create the following items using template ‘/sitecore/templates/Data Exchange/Framework/Data Access/Mapping/Value Mapping’
- Identifier Source Accessor -
- sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers/Sql Server/Location Information Fields/Identifier
- Target Accessor - sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers/Sitecore/Location Info Item Fields/Identifer
- State Name
- Source Accessor - sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers/Sql Server/Location Information Fields/State Name
- Target Accessor - sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers/Sitecore/Location Info Item Fields/ State Name
Sitecore Template Create a sitecore item with the following fields with Name ‘Location Data’
- Identifier – Shared and Single Line text
- State Name- Shared and Single Line text
Add Value AccessorsCreate Item under /sitecore/system/Data Exchange/Location Data Exchange Tenant folder with name ‘Location Data Access ‘ using template ‘/Data Exchange/Framework/Folders/Folders for Data Access/Data Access Root’Create Item under Location Data Access with name ‘Value Accessor Sets’ using ‘/Data Exchange/Framework/Folders/Folders for Data Access/Value Accessor Sets Root’ templateCreate SQL Server Provider with following info
- Template Name - /Data Exchange/Providers/SqlServer/Folders/Sql Server Value Accessor Sets Root
- Item Name - Sql Server(Item Path - /sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers)
Under the above Item SQL Server Create following item
- Template Name - Array Value Accessor Set
- Item Name - Location Information Fields(Path - /sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers/Sql Server)
value accessor items to the value accessor set created in the above step.For doing this, Add the following item
- Item Name – State(Item path - /sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers/Sql Server/Location Information Fields)
- Template /sitecore/templates/Data Exchange/Providers/SqlServer/Data Access/Array Value Accessor
Create Item with name sitecore using template ‘/sitecore/templates/Data
- Item Name – Identifier(Item path - /sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers/Sql Server/Location Information Fields)
- Template - /sitecore/templates/Data Exchange/Providers/SqlServer/Data Access/Array Value Accessor
Create Item with name sitecore using template ‘/sitecore/templates/DataExchange/Providers/Sitecore/Folders/Sitecore Value Accessor Sets Root’.Item path is /sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers/SitecoreUnder the above Folder Sitecore,Create Item ‘Location Info Item Fields’ using template ‘/sitecore/templates/Data Exchange/Providers/Sitecore/Data Access/Value Accessor Sets/Sitecore Item Field Value Accessor Set’Under State Info Item , Create Item ‘State Name’ using template ‘/sitecore/templates/Data Exchange/Providers/Sitecore/Data Access/Value Accessors/Sitecore Item Field Value Accessor’.Under State Info Item , Create Item ‘Identifier’ using template ‘/sitecore/templates/Data Exchange/Providers/Sitecore/Data Access/Value Accessors/Sitecore Item Field Value Accessor’.Setting Up PipelineCreate an item with name ‘Pipelines’ using template ‘/Data Exchange/Framework/Pipelines/Pipeline’Under Pipelines, add item with name ‘LocationInfo from SQL’ using template ‘/Data Exchange/Framework/Pipelines/Pipeline’Add Item Under ‘Location Info From SQL’ with name ‘Resolve Location Info Item’ using Resolve Sitecore Item Pipeline Step templatePopulate following Fields of Resolve Location Info Item
- Template for New Item-Templates/Location/Location Data/Facility
- Item Name Value Accessor(Item will be created with this name) - sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers/Sql Server/Location Information Fields/State
- Endpoint From - sitecore/system/Data Exchange/Location Data Exchange Tenant/EndPoints/Providers/Sitecore/Sitecore Database Endpoint
- Resolve Location Info Item –
- Parent For Item(This is folder where we need to import data) - sitecore/content/HealthSouth/content/location/facility_import
- Matching Field Value Accessor - sitecore/system/Data Exchange/Location Data Exchange Tenant/Location Data Access/Value Accessor Sets/Providers/Sitecore/Location Info Item Fields/State Name
Navigate to the pipeline LocationInfo From SQL and add Item with name ‘Update Sitecore Item’ using template ‘Update Sitecore Item Pipeline Step’The above item ‘Update Sitecore Item’ contains a field called ‘Endpoint To’. Select ‘sitecore/system/Data Exchange/Location Data Exchange Tenant/EndPoints/Providers/Sitecore/Sitecore Database Endpoint’ in the dropdown.Create Item with name ‘Apply Mapping’ using template ‘Apply Mapping Pipeline Step’ under node ‘/sitecore/system/Data Exchange/Location Data Exchange Tenant/Pipelines/LocationInfo From SQL’. Select Value Mapping Sets/State Name as value for field ‘Mapping Set’.Create an item under ‘/sitecore/system/Data Exchange/Location Data Exchange Tenant/Pipelines’ with name ‘Read Location Data From SQL’ using the template ‘/Data Exchange/Framework/Pipelines/Pipeline’.Create an item under ‘/sitecore/system/Data Exchange/Location Data Exchange Tenant/Pipelines/Read Location Data From SQL‘ with name ‘Run Location Select Statement’ using template ‘Run Select Statement Pipeline Step’.Select Item ‘sitecore/system/Data Exchange/Location Data Exchange Tenant/EndPoints/Providers/SQL/Location Statement Endpoint’ for field ‘EndPointFrom’ field for this item.Create Item ‘Iterate SQL Data and Run Pipeline’ using template ‘Iterate Data and Run Pipelines Pipeline Step’ under ‘/sitecore/system/Data Exchange/Location Data Exchange Tenant/Pipelines/Read Location Data From SQL’.Select Item ‘LocationInfo From SQL’ in the field ‘Pipelines’.Create Pipeline BatchNow, we need to set up the pipeline batch which runs the pipelines.It can be run manually or using Sitecore Task scheduler.To do this , Navigate to /sitecore/system/Data Exchange/Location Data Exchange Tenant’ and add Item with name ‘Sitecore Pipeline Batch’ using template ‘/Data Exchange/Framework/Pipeline Batches/Pipeline Batch’.Under this item add ‘Location Info from SQL Database’ using template ‘/Data Exchange/Framework/Pipeline Batches/Pipeline Batch’.There is a field with name ‘Pipelines’ , select ‘Read Location Data From SQL’ in the field.