Advanced Workflow Configuration

The workflow config _wfconfig.ps1 itself is a PowerShell script.

It is executed:

In this case the engines executed the config file and serializes the result in an encrypted fashion on disk in the _wfdata subfolder of the workflow folder.

Because the workflow is a script you are able to do you own stuff. But you need to keep in mind that it is not executed on every workflow run for performance reasons.

You can tell the engine not to serialize the config file. In this case it will execute on every workflow run!

To do so you can specify property NoSerializing = $true in the _wfconfig.ps1.

But it's not always necessary to prevent serialization. Most of the time it will be sufficient to execute it once.

You can use own code to configure the workflow.

For example if you want to configure the SharePoint web and list the workflow is working at depending of the workflows folder:

This is a pseudo-code _wfconfig.ps1:

$path = Split-Path $MyInvocation.MyCommand.Path
$list = ""
if( $path -like "c:\workflows-production\*") {
    $list = "Custom List Production"
	$web = "Production Web"
} else {
    $list = "Custom List Dev"
	$web = "Dev Web"
}

@{
    #... other settings ...
	
	Web = $web;
	List = $list;
	
	#... other settings ...
}

if(!$kenaflow){Import-Module "C:\Program Files\kenaflow\kenaflow.runtime.dll";Test-KFConfig;exit}

Discussion