Wednesday, 4 October 2017

Sitecore PowerShell script to remove workflow from content items

Recently we had a situation in one of the projects where the client wanted to remove the workflow from all the items under Home, but wanted to keep them on standard values for some templates. Below is the Sitecore PowerShell script that was used to do so:

The above script can also be used to move items from one workflow state to other by changing workflow state value.
  • The above script goes through every item under “/sitecore/content/Home”
  • Disable the security for editing the items (required to make sure we don’t get permission errors like: The current user does not have write access to this Item. User: Sitecore\virtualssuser
  • Begin the item edit.
  • Update the workflow fields value.
  • End item editing.
  • 1 comment: