Push SPEAK templates before dependent SPEAK items


Description

The article describes how to avoid Sitecore Content Serialization failure when pushing SPEAK items to a Sitecore instance.

Sitecore Content Serialization (SCS) requires that you push templates first when importing serialized SPEAK items into a Sitecore instance.

Be careful when restoring SPEAK items from scratch after the SPEAK root item with its descendants and SPEAK templates have been removed. If these items have been previously serialized, restoring them at this point will fail. 

Solution

To make sure that you push the SPEAK templates before all items that depend on the templates, do the following:

  1. Open the Project.module.json file.
  2. Move the SPEAK_Templates node to the top of the list of SPEAK items to push:
    { 
    "namespace": "Project",
    "resources": ["*/*.json"],
    "items": {
    "includes": [
    {
    "name": "SPEAK_Templates",
    "path": "/sitecore/client/Speak/Templates"
    },
    {
    "name": "SPEAK_Layouts",
    "path": "/sitecore/client/Speak/Layouts"
    },
    {
    "name": "SPEAK_System",
    "path": "/sitecore/client/Speak/System"
    }
    ]
    }
    }
  3. Save the Project.module.json file.
  4. Use SCS to push the SPEAK items to the Sitecore instance.

SPEAK App Items

The same problem exists with SPEAK apps and their items, and the same solution can be used. In the Project.module.json file, move the SPEAK_APP_Templates node to the top of the list of SPEAK app items to push:

{
"namespace": "Project",
"resources": ["*/*.json"],
"items": {
"includes": [
{
"name": "SPEAK_APP_Templates",
"path": "/sitecore/client/Sitecore/Applications/Examples/OM/Templates",
"database": "core"
}
,
{
"name": "SPEAK_APP_ExistingOrders",
"path": "/sitecore/client/Sitecore/Applications/Examples/OM/Fake Data",
"database": "core"
},
{
"name": "SPEAK_APP_Pages",
"path": "/sitecore/client/Sitecore/Applications/Examples/OM/Pages",
"database": "core"
}
]
}
}