Get-KFInDebug

Syntax

Get-KFInDebug 
  -EvalAllStates 
  [-ThrowErrors[:$true]]
Get-KFInDebug 
  -ScriptDebugState 
  [-ThrowErrors[:$true]]
Get-KFInDebug 
  -WorkflowDebugState 
  [-ThrowErrors[:$true]]
Get-KFInDebug 
  -WorkflowStateDebugState 
  [-ThrowErrors[:$true]]

Support

>= kenaflow 2.0.3

Return

Boolean.

$true means that the workflow is "in debug mode"

$false means the workflow is running in automatic mode.

Description

This Cmdlet returns $true when the workflow script is in debug mode. Otherwise $false.

This allows code to be built into workflow scripts, which is executed only in the debug case.

Parameters

-EvalAllStates

This evaluates all three possible sources for the debug flag. If at least one of the states yields $true then the Cmdlet also returns $true.

-ScriptDebugState

With this switch parameter the cmdlet will return $true only then debugging a script in an PowerShell debugger like PowerShell ISE or Visual Studio Code.

-WorkflowDebugState

In _wfconfig.ps1 the parameter Debug = $true can be specified to mark the top-level workflow as a "development version".

-WorkflowStateDebugState

In _wfconfig.ps1 each status of a Statemachine Workflow can be marked separately with the parameter Debug = $true.

[-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.

Examples

$timestamp = $item["Modified"]
if( (Get-KFInDebug) ) {
	$timestamp = $timestamp.AddDays(1)
}

if( $timestamp -lt (Get-KFDateTime -Utc) ) {
	Send-KFMail -Subject "Reminder" -Body "Please do something" -To "{{Author}};{{Editor}}"
}

Discussion