Sitecore 8.2: Managing Datasource components and Workflow from the Experience Editor

The launch of Sitecore 8.2 just a few days ago brought with it a a huuuuuge list of updates and enhancements. One of those great new features is an update in the Experience Editor to make the life your content editors much simpler and better to managing the content through workflow.

Component based design/architecture seems to have gained a lot more traction again in recent times especially with the Habitat project. But Sitecore itself has fully support component based design since version 6.4 (at least) with the numerous enhancements that were made to the Page Editor in that release to add better support for Datasources. In order to fully utilize all the analytics and personalisation features, you have to use datasources, you’ll be fighting the framework if you don’t.

Due to its page-based nature, the Page Editor/Experience Editor has also had problems giving appropriate information to the editors when dealing with heavily data-sourced pages and content items that may be used on several pages.

This leads to numerous problems:

  • You don’t know where a datasource is used. Making a change on a component in one page may affect several other pages when the datasource is shared or used on multiple pages.
  • You can’t be sure that a page will not be broken after publishing. When you workflow content, you don’t know what state a page is in as a whole. Although the page item itself is in the Approved/Final state of workflow, the associated content used on that page may not be. Therefore publishing a page even with the “publish related item” option would still not publish those non-final datasources.

So as we all do, we all use a bunch of workarounds to solve this. Some examples are:

  • Datasource Workflow Module – Editor Notifications and Warnings to show workflow state of components linked in on the current page
  • Workflow Bundling – moving component datasources through Workflow with the page item
  • Component Error handling – If all goes wrong, handle/shallow the error so the user is not shown a 500 page.
    There are multiple examples of the above, I’m not singling out any specific article as “the best”

Some new features and UI enhancements have been introduced in Sitecore 8.2 to allow us to work better with datasources…

Datasourced Component Highlighting

In Experience Editor mode, there is a new option that can be enabled from the View tab of the Ribbon.

01. Enable Associated Content

Turning on the “Associated content” option will highlight with a green dashed frame all components on the page which have a datasource set.

02. Associated Content Highlighting

Component Datasource Workflow State

The component webedit toolbar has also been extended to show the workflow state of the components associated datasource.

03. Component Workflow State

If a component datasource is not in a final workflow state then you can progress the item through the workflow and take action directly from the Experience Editor:

04. Compontent Datasource Workflow Approve

Component Datasource Usage Information

The eagled-eyed amongst the readers may have noticed in the previous images a new usages counter in the component webeedit toolbar as well.

Clicking the Usages count will pop open a new modal which shows you:

  • Details of the content item
  • List of other pages that also use this content item

This will give the content editors a lot more confidence when updating content to know exactly how many times a piece of content is used and how other parts of the site this single change will also affect.

05. Component Datasource Usage Info

Page level Associated Content overview

The use of component based design can lead to heavily datasourced pages, and it may become difficult to track exactly what content items are used on a single page.

A new Associated Content ribbon button has been added which lists all content items that are used on the page and their current workflow state. Clicking on any item will open the at the top of the Experience Editor (in the same way that selecting Edit Related Item currently does):

06. Assciated Content Ribbon

Editor Notifications

A new set of Experience Editor warning have also been added to provide editors more information that publishing the current item and related items will affect other pages on the site since the datasource is used on multiple pages:

07. Datasource Use PageEditor Warning

You’ll also be present with a warning if you try to publish a page which contains datasources which are not in final workflow state, which could cause a 500 error if the page were published in the current state.

08. Datasource Non-Final Workflow Publish Notification

If you switch over to preview mode, you’ll also be warned with a ribbon notification of any datasource items are in a non-final workflow state:

09. Datasource Preview Notification

Workflow Bundling

As part of the Workflow, a new feature has been added that will move all datasource itmes on a page through the workflow at the same time as when the main item is moved through the workflow. This should help ensured that when an editor meant to “create a page, add content, approve it and publish to the website”, this is what actually happens.

This has been added using feature toggling, so you can disable it by setting WebEdit.AffectWorkflowForDatasourceItems to false.

<!--
WEB EDIT AFFECT WORKFLOW FOR DATA SOURCE ITEMS 
Move datasources through the workflow with the context item. Default value: true 
-->
<setting name="WebEdit.AffectWorkflowForDatasourceItems" value="true" patch:source="Sitecore.ExperienceEditor.config"/>

10. Workbox

That should make everyone’s lives a little easier.

6 comments

  1. Ian · October 11, 2016

    Does WebEdit.AffectWorkflowForDatasourceItems only work if the page & data sources are in the same workflow?

    What happens if the page & data sources are in different workflows, how would it update the data sources to the next corresponding workflow state?

    Is there any documentation on this?

  2. Chris Thompson · December 12, 2017

    Great article – I did not know this had been introduced! We used to have to implement something similar as a customisation to work around this not being there.

    One question though – any idea if this is expected to work in Content Editor and Workbox or just Experience Editor? A couple of quick tests suggests it’s just Experience Editor…which is a nuisance.

    Thanks

    • jammykam · December 12, 2017

      I don’t know off the top of my head I’m afraid, I’ve been working on older projects using the customer Workflow action like most people have to provide this functionality… seems surprising that it’s EE only… I would raise this with Sitecore Support since I would expect it to work in all modes. I’ll dig into the code to take a look if I have time.

      • Chris Thompson · December 13, 2017

        No worries …I did raise it with Sitecore, and the response this morning was that it only works in EE. They’ve put in a feature request for it to cover all areas.

        Bit of a shame…but I guess we’ll need to stick with custom implementations for Content Editor and Workbox for now.

        Cheers

  3. Pingback: WebEdit.AffectWorkflowForDatasourceItems – collect datasource children items | Coffee First based .NET and Sitecore Dev
  4. Pingback: Workflow bundling bug | Sitecore basics!

Leave a comment