Invoke-Kenaflow

Syntax

Invoke-Kenaflow
  [-WFConfig <path-to-wfconfig>]  
  [-EventData <scriptblock>]  
  [-ItemId <list-item-id-as-int>]  
  [-List <list-title>]
  [-Web <web-url>]
  [-AllStates[:$false]]  
  [-DumpConfigValues[:$false]]  
  [-Breakpoint[:$false]]  
  [-NoPreQueryScript[:$false]]  
  [-IgnoreTBE[:$true]]  
  [-IgnoreDebugBreaks[:$false]]  
  [-ErrorActionPreference <kenaflow-error-action-preference> (Stop)]  
  [-ThrowErrors[:$true]]  

Support

>= kenaflow 1.0.0

Return

Nothing.

BUT...

  • In case of "unstructured data" remote event debugging it could return data - if the workflows is configured to do so.
  • In case of "link events" that request an answer from the workflow the return object is a HTML string.

Description

This cmdlet is used to initialize the kenaflow runtime for debugging.

Therefore it's used only in PowerShell development applications such as "PowerShell ISE" or "Visual Studio Code".

If part of the "Magic Line":

if($wf-eq$null){Import-Module "C:\Program Files\kenaflow\kenaflow.runtime.dll";Invoke-Kenaflow;exit}

We have described debugging in this article: Debugging. Please read it for details.

Use the -PreWorkflowExecution parameter to specify a script block to execute before running the workflow script to debug. For example you can initialize variables with this parameter. It is described in article Debugging.

Use the -WFConfig parameter to specify the path to the workflow configuration file _wfconfig.ps1, which should be used to initialize kenaflow for debugging the workflow script file. If the parameter is not specified, the workflow configuration file is read from the same directory in which the workflow script to be debugged is located.

The parameter -EventData can be used to configure the debug environment to execute remote events. They are "simulated" as described in article Debugging.

With the -ItemId parameter, kenaflow can be forced during debugging to load a specific list item and pass it to the workflow script to be debugged. This may be useful, for example, when the list item is in a certain state or is brought to test a particular workflow situation.

This belongs only to SharePoint state machine workflows: With the parameter -AllStates you can instruct kenaflow to execute the scripts for all workflow states. You could debug them all at once by setting breakpoints in all state scripts. - If not specified the only the state script that was started will be executed and the engine (in this debug environment) will skip the other state scripts. The state that the script belongs to is figured out by the workflow configuration.

Use the -Breakpoint parameter to tell kenaflow to put a PowerShell breakpoint on the first line of the script so that the PowerShell debugger stops there. This can be useful after restarting the IDE when all breakpoints are cleared to prevent kenaflow from going through the workflow script completely without stopping. - Nowadays, we recommend to use Invoke-KFDebugBreak.

Most workflows have a setting "Time Between Execution" which specifies how much time must elapse between two executions of the workflow. - In debugging this is ignored. But if you want to test it use -IgnoreTBE:$false.

Parameters

Most of the parameters are described in the "Description" above!

[-WFConfig <path-to-wfconfig>]

Described above.

[-EventData <scriptblock>]

Described above.

[-ItemId <list-item-id-as-int>]

Described above.

[-List <list-title>]

In case of SharePoint workflows with multiple lists per web you can specify a filter here for the list title. - The name of the list is case sensitive and must match.

[-Web <web-url>]

In case of SharePoint workflows with multiple webs you can specify a filter here for the web URL. The web URL is case insensitive.

[-AllStates[:$false]]

Described above.

[-DumpConfigValues[:$false]]

If set the engine will write the config values the the kenaflow log that is shown in the PowerShell console/output window.

[-Breakpoint[:$false]]

Described above.

[-NoPreQueryScript[:$false]]

Can be used to disable the execution of the workflow's pre-query script.

[-IgnoreTBE[:$true]]

Described above.

[-IgnoreDebugBreaks[:$false]]

Described above.

[-ErrorActionPreference <kenaflow-error-action-preference> (Stop)]

Described above.

[-ThrowErrors[:$true]]

This is a default parameter for all kenaflow cmdlets. If set to $true (default!) the engine will pass exception within the cmdlet to the script for further handling.

Example

Invoke-Kenaflow # :-)

Discussion