In general there are four start options for SharePoint workflows:
- Start manual
- Start when an item changed
- Start when a new item is created
- Start workflow to approve publishing a major version of an item
When you use Visual Studio workflows or the built-in MOSS Approval Workflow you have all options. But with declarative workflows like SharePoint Designer and Nintex Workflows you have only the first three options.
Start workflow to approve publishing a major version of an item
You can’t use declarative workflows to approve publishing a major version of an item. Lose that option can really hurts!

Take a look at the SharePoint object model
In the object model the DefaultContentApprovalWorkflowId property of the SPList contains the the id of the workflow association which should be started to publish a major version.
So we only need to find the association id of our declarative workflow and set the DefaultContentApprovalWorkflowId property – maybe with PowerShell?
Yes and No! This works until the association id will change. And it will change every time the workflow changes! Manual set the DefaultContentApprovalWorkflowId every time the workflow changes? Cumbersome!
The solution
Declarative workflows (xoml files) will be stores in a hidden document library. You can see the library in SharePoint Designer:
Just let an event receiver do the work! Every time the workflow file changes get the new association id and set the DefaultContentApprovalWorkflowId of the target list.
PowerShell Implementation
Exemplarily I will show an implementation with PowerShell and PowerEventReceiver.
#workflow must be associated with the target list $workflowFileName = "Nintex Test.xoml"
$targetListTitle = "TestLib"
function ItemUpdated()
{
if($item.DisplayName -eq "$($workflowFileName).wfconfig")
{
$binFile = $item.File.OpenBinary() $wfConfig = [xml][System.Text.Encoding]::UTF8.GetString($binFile)
$baseId = [Guid]$wfConfig.WorkflowConfig.Template.BaseID
$lib = $web.Lists[$targetListTitle]
$assoc = $lib.WorkflowAssociations.GetAssociationByBaseId($baseId)
$lib.DefaultApprovalWorkflowId = $assoc.Id $lib.Update()
}
}
- Change $workflowFileName and $targetListTitle appropriately. The workflow should already be deployed on the target list. Manual start option must be activated for the workflow. You can find the file name of the workflow with help of SharePoint Designer or PowerShell.
- Save the script and resave/republish the SPD/Nintex workflow.
- Publish a major version of a document:
- After entering a comment you’ll see the initiation form of your content approval workflow. In my case a beautiful Nintex Workflow, in other cases an ugly SharePoint Designer Workflow ;-)
Now you can change the workflow without lose the content approval workflow.