8

We recently switched from code-first to Sitecore-first in our JSS project.

In the Sitecore-first approach we now use Unicorn to serialize/sync Sitecore structure and content.

However the JSS Development Workflow is still in effect when creating a new item.

How can I deactivate this workflow completely?

7

To disable workflow entirely across your JSS templates and existing items, you can use the following bit of Sitecore PowerShell to clear the Default workflow on templates, and the Workflow and Workflow state on content items.

Note that this script totally removes all workflow from the referenced content and template paths, so use with care if you have other existing workflows you wish to preserve.

$contentRoot = Get-Item "master:\content\jss-react-sample"
$templatesRoot = Get-Item "master:\templates\Project\jss-react-sample"

# Disable workflow on the templates
$templatesCount = 0
$templatesRoot | Get-ChildItem -Recurse | ? { $_.Name -eq "__Standard Values" } | % {
    $_.Editing.BeginEdit()
    $_.Fields["__Default workflow"].Reset()
    $_.Editing.EndEdit() | out-null
    $templatesCount++
}
Write-Host "Updated $templatesCount templates"

# Remove workflow on existing content
$contentCount = 0
$contentRoot | Get-ChildItem -Recurse | % {
    $_.Editing.BeginEdit()
    $_.Fields["__Workflow"].Reset()
    $_.Fields["__Workflow state"].Reset()
    $_.Editing.EndEdit() | out-null
    $contentCount++
}
Write-Host "Updated $contentCount content items"
  • Thanks for the reply. Checked the script on my local machine and can now create a new Item that does not have the Default JSS Workflow when I check the workflow fields. However, is still see the warning message explaining that the Item will be overridden in the next Jss Import. Will deleting the JSS Development Workflow remove this message, or is there another way to do this? – Jan-Pieter Apr 2 '19 at 14:07
  • @Jan-Pieter That warning is independent from the workflow, since even after removing the workflow (actually, especially after removing) the import could still overwrite those items. You can remove it by ensuring that the import user (sitecore\JssImport by default) does not have write access to the app/site item tree. – techphoria414 Apr 2 '19 at 14:46
5

The simplest way will be just removing the Default workflow from the existing template's standard value and update/enable it back when needed. Also the new templates needs to be created without any default workflow and setup later when needed.

Note - If you have lot of existing templates, can try execute a power-shell command to set/revoke default workflow.

enter image description here

Anyways you are planning to go with Sitecore first and Unicorn for content sync, so nothing will overwrite your template changes until you revert back.

As an additional note the default workflow for jss app is set in the \Website\App_Config\Sitecore\JavaScriptServices\Sitecore.JavaScriptServices.Apps.config file,

Anyways no update required here in your case, as you are planning for Sitecore first with Unicorn.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.