Long Running Sitecore Workflows
Posted 31 March 2014, 15:42 | by Ben Duguid | Perma-link
Note: This has been sitting in my queue for nearly a year, mainly because I didn't find a nice solution that worked with workflows - but I thought I'd finish it up and move on - 10/02/2015
I've been looking into some options for informing editors about the state of long running processes when carrying out a Sitecore workflow action. Typically, the UI will freeze while the workflow action is happening - which can cause issues with browsers (I'm looking at you Chrome) that decide that the page has timed out and just kill it.
In our particular case, we are generating a static copy of our site (as XML, html and a packaged .zip container) for use within a Magazine App container - the content is all hosted via a CDN, and only gets updated when a new issue is published. However, processing a number of issues and languages can take a little while.
I'm currently favouring a fairly simple Sitecore Job running in the context of a ProgressBox, which is working, but has a few rough edges.
The key advantages this method has are:
- It keeps the connection between the browser and the server active, which keeps Chrome happy.
- There's a visual indication that "something is happening", which keeps editors happy.
The issues I'm currently looking into however include:
- Because the task is running asynchronously, the workflow action "completes" (at least from a code point of view) before the Job finishes.
- Because of 1, there's no way to stop the workflow and mark it as "failed" if there are issues with the process.
Not long after I started writing this, the client requested that we remove the various status checks from the workflow conditions (so they could run the process for staging without having to complete the entire magazine) and I came to the conclusion that having this as a Sitecore Workflow didn't really work for because the editors workflow was: work on a few pages, package for staging, work on a few more pages, package to staging, etc. until it was ready to package to production - with the Workflow in place they had to keep rejecting the build to staging so they could re-run that step.
We therefore needed to replace the workflow with some custom ribbon buttons allowing the editors the package the content for staging or production as needed.
Filed under: Sitecore, Sitecore Jobs, Sitecore Workflow