Bug: Sitecore 8.1 Workflow Commands Do Not Work When Item Is Not Saved
UPDATE: Issue is fixed with Sitecore Experience Platform 8.1 rev. 160302 (8.1 Update-2)
As I’m sure is true with others, the desire to jump into Sitecore 8 is a strong one. Recently, I had the the pleasure of leading an Sitecore 7.5 -> Sitecore 8.1 Update 1 (rev. 151207) upgrade, and came out somewhat unscathed. However, there were definitely some “gotchas” that are worth sharing.
The first involves a workflow bug that happens when you attempt to send an item through the workflow steps if the item is not saved and has a validation error, such as a broken link at the time of triggering the workflow command.
For example, let’s say you’re working on an item, you make a few changes, accidentally breaking a link and without saving first, you push the “Submit” button in your workflow. As it should, Sitecore will ask you to save the item, and upon choosing “Yes” to save, Sitecore will actually fail, throwing multiple undefined errors, and eventually doing nothing.
In our scenario, it was actually much worse. We have multiple custom workflow actions tied to the state commands. These custom actions actually incite a process in which clones are propagated to local regional nodes, and in some cases, auto-publish to one or more publishing targets. Sitecore will actually kick-off these processes which perform their actions against the latest saved version, which is NOT the one you’re currently working one. This actually causes Sitecore to clone and publish the wrong version of the item. As you can imagine, this can be quite a scary situation.
It’s important to note that this only occurs under the following conditions:
- The item is not saved at the time of the workflow command execution.
- The item has one or more validation issues, such as a broken link.
The error does not happen if you save the item first, and acknowledge the alert regarding the validation issues. This may seem like a simple resolution, and in many cases, it might be. Save first, then execute the workflow command. Unfortunately, if you have any custom workflow actions that get executed, they may perform their actions against the wrong version of the item. As much as I’d like to believe that content authors can be trained to save first, it is plausible to assume that they will forget once in a while and go directly to the workflow command.
If you’re thinking about upgrading, please make sure you upgrade directly to the latest version of Sitecore.