List Workflow Complete Template

@{
    #* A workflow will only work with the following version of 
    #*   kenaflow. After you tested your workflow with a new 
    #*   version of kenaflow you can change the following setting. 
    Version = "3.0";
    
    #* set it to $true to ENABLE the workflow. ($false DISABLES it)
    Enabled = $false; 
    
    #* Type = SHAREPOINT, EMAIL, POWERSHELL
    Type = "SHAREPOINT";
    
    #* SubType 
    #*   if "SHAREPOINT" then ALL, LASTMODIFIED (alias LIST), 
    #*   QUERY, SITE, STATEMACHINE if "EMAIL" then 
    #*   EXCHANGE2007SP1, EXCHANGE2010, EXCHANGE2010SP1, 
    #*   EXCHANGE2010SP2, EXCHANGE2013, EXCHANGE2013SP1, 
    #*   EXCHANGE, EXCHANGEONLINE, POP3, IMAP if "POWERSHELL" => EMPTY
    SubType = "LIST";
    
    #* set it to a meaningful name
    Name = "<<wfname>>"; 
    
    #* what SharePoint do you use? Possible values: "sp2013" or 
    #*   "sp2016" or "sp2019" or "spo"  
    Platform = ""; 
    
    #* a unique (!) id (type 'System.Guid') for this workflow. 
    #*   must be unique in YOUR environment.  Use 
    #*   "[guid]::newGuid().tostring('d')" to create a GUID in 
    #*   Powershell.   
    Id = "<<wfid>>"; 
    
    #* option. can be used to specify the folder where the 
    #*   workflow scripts are in. the workflow directory  (where 
    #*   the _wfconfig.ps1 is in) is used if empty.   
    #ScriptFolder = ""; 
    
    #* "Time before execution" => minimal time difference IN 
    #*   SECONDS between two executions of the workflow  
    TBE = 60; 
    
    #* CRON-style pattern for execution scheduling. Please 
    #*   consult our documentation to get more infos on that.   
    #Cron = "0 * * * *"; 
    
    #* This can be used to specify one or more custom 
    #*   PowerShell libariy files that will be executed before  
    #*   workflow script execution.  
    #CustomLibrary = @(""); 
    
    #* Here you can specify a script for error handling. It's 
    #*   processed in case of exceptions within the workflow script. 
    #*   Please read https://doc.kenaflow.com/basics/errorhandling 
    #ErrorHandlingScript = "errorHandling.ps1"
        
    #* Can be used to mark this workflow as "in debug" for use 
    #*   with cmdlet Get-KFInDebug -WorkflowDebugState  
    #Debug = $false; 
    
    #* This file will be serialized for performance reasons. 
    #*   You can prevent serialization by setting this option.
    #NoSerializing = $false;
    
    #* This file will be serialized for performance reasons as 
    #*   long as property 'NoSerializing' is not set to $true. 
    #*   But you can specify a "maximum lifetime" here. if this 
    #*   amount of time elapsed the workflow configuration gets 
    #*   re-serialized. Possible values are TimeSpan (object or 
    #*   string) or amount of seconds (int or string)  
    #MaxLifetimeOfSerialization = "0:5" #5 minutes
    
    #UserProfileCacheLifetime = 60; #In seconds. If not specified the global setting from kenaflow.conf is used
    
    #* Force workflow script to run again in case of "version 
    #*   conflict" (parallel item modifications in SharePoint). 
    #*   Default: $false  
    #RetryOnVersionConflict = $false; 
    
    #* If set to $false the workflow will continue with the 
    #*   next item on workflow script errors.  Default ist $true 
    #*   ("stop workflow on script errors")  
    #StopWorkflowOnScriptError = $true; 
    
    
    #* The following two parameters can be used to specify credentials
    #*   however it is possible to store credentials in a 
    #*   protected fashion using the parameters --setusername  
    #*   and --setpassword on kenaflow.exe while running the 
    #*   program inside a workflow folder that contains  
    #*   _wfconfig.ps1. this will create a file 
    #*   _wfconfig-cred.ps1 that contains encrypted credentials. 
    #*   the  credentials can only decrypted on the same machine. 
    #*   on other machines the file is worthless.  
    #spUser = "";
    #spPwd = '';
    
    #* only if platform is 'spo' = SharePoint Online
    #spoAppId = ""; 
    #* only if platform is 'spo' = SharePoint Online
    #spoAppSecret = ''; 
    
    #* Starting with kenaflow 3.0 you can execute a SharePoint 
    #*   workflow on multiple lists in multiple webs.  The 
    #*   executed workflow script is always the same. All other 
    #*   settings are identical (names of lists  such as error 
    #*   list or data list). But the lists can be configured per 
    #*   web. If you configure this  property you cannot 
    #*   configure `Web`, `AlternateWebUrls` and `List` in parallel. 
    <#
    Connection = @(
      @{ 
        Web = "https://firstweb.sharepoint.farm"; 
        List = @("List 1", "List 2");
        AlternateWebUrls = @();
      },
      @{ 
        Web = "https://secondweb.sharepoint.farm"; 
        List = "List 3";
        AlternateWebUrls = @();
      },
      @{ 
        Web = "https://thirdweb.sharepoint.farm"; 
        List = @("List 4", "List 5");
        AlternateWebUrls = @();
      }
    )
    #>

    #* Full URL to the SharePoint web where the workflow list 
    #*   is in  
    Web = ""; 
    
    #* Title of the SharePoint list where the workflow operates 
    #*   on. This list is called "workflow list". You can 
    #*   configure multiple list for the workflow by using a 
    #*   PowerShell list object: @("List 1", "List 2") 
    List = @(""); 
    
    
    #* A list of alternate URLS, e.g. if a web application has 
    #*   Alternate Access Mappings. Remove Events could be 
    #*   received with such an alternate URL  
    #AlternateWebUrls = @();
    
    #* a list for global config values
    ConfigList = "WFconfig"; 
    
    #* a list that can be used to store data
    DataList = "WFData"; 
    
    #* a list that can be used to record log information
    HistoryList = "WFHistory"; 
    
    #* Workflow errors will be stored in this SharePoint list
    ErrorList = "WFErrors";
        
    #* Can be uses to define default config entries that will 
    #*   be deployed to the config list if the workflow config 
    #*   list is created by kenaflow (kenaflow.exe)  
    ConfigListDefaults = @{
        "kenaflow" = "cool"
    }; 

    #* List of mail addresses that will receive mails in case 
    #*   of workflow internal errors.  
    AlertAddresses = @(); 
    
    #* can be used to overwrite the global settings.
    #AlertFloodProtection = 3600; 
    
    #* Address of the sender of mails that the workflow sends. 
    #*   If empty it will be taken from the kenaflow global config 
    #MailFrom = ""; 
    
    #* Address to which uses can reply to. If empty it will be 
    #*   taken from the kenaflow global config  
    #MailReply = ""; 
    
    #* This script contains all to workflow actions
    #Script = "script.ps1";
            
    #* After this amount of time elasped the workflow execution 
    #*   will be stopped; -1 = use default  
    #MaxExecutionTime = -1;     

    #* This script is executed before querying 
    #PreQueryProcessing = "preQueryProcessing.ps1";
    
    #* Specified whether the Workflow needs Remote Event 
    #*   Receiver to execute the workflow scripts immediately 
    #*   after a change in SharePoint.   
    RER = $false; 
    
    #* Optional, but must be used if multipe workflow listen to 
    #*   the same list!!  
    #RERHandlerName = "kenaflow_wf1"; 
    
    #* Specifies how long a Remote Event is valid before it is 
    #*   skipped forever (if not processed). Default: 
    #*   configuration in global config. There is default: 120s.  
    #MaximumRerLifetime = 120;
    
    #* Specifies how long a a remote event is postponed in case 
    #*   of errors during processing. Default: configuration in 
    #*   global config. There is default: 5s.  
    #PostponeFailedRer = 5;
    
    
    #* if false the 'last modified' flag file is used
    #LastModifiedBasedOnLastRun = true; 
    
    #* Count of list items queried from SharePoint at one 
    #*   request. -1 = use default  
    #ItemBatchCount = -1; 
    
    #* Amount of time before each item is checked to be 
    #*   processed. -1 = use default; 0 = check immediately  
    #ItemReCheckTime = -1; 
    
    #* Handle lists and libraries "flat" by ignoring folders. 
    #*   Default: $false  
    #IgnoreFoldersInQuery = $false;
    
    #* In case of using SubType 'QUERY' you can specify a query 
    #*   for item processing here.  
    #Query="{{Title}} == string 'Test' & {{Modified}} > datetime [[TODAY]] & {{Editor}} != lookupid [[USERID]]"; #used only if 'Type' == 'query'
    #* You can specify CAML instead. {{ }} tokens are processed 
    #*   at runtime  
    #Query="<Where><And><And><Eq><FieldRef Name='Title'/>"+
    #      "<Value Type='Text'>Test</Value></Eq><Gt>"+
    #      "<FieldRef Name='Modified'/><Value Type='DateTime' IncludeTimeValue='TRUE'>"+
    #      "<Today/></Value></Gt></And>" +
    #      "<Neq><FieldRef Name='Editor'/><Value Type='Lookup'>"+
    #      "<UserId/></Value></Neq></And></Where>";
    
    #* If you only want to process item with changes in certain 
    #*   item fields (columns) you can specify the list of names 
    #*   here. If you want only process items with changes in any 
    #*   field you can set this simply to $true.  
    #ItemChangeHashFields = $true;
    #ItemChangeHashFields = @("Title", "CustomField");

    #* Some item permission related Cmdlets in workflows can 
    #*   simply set "CRUD" +M (Manage) +A (Approve)  permissions 
    #*   by specifying some characters from set [C, R, U, D, M, 
    #*   A]. They refer to permission  set that the Site 
    #*   Collection administrator has to create. They must also 
    #*   be named here  
    #PermissionSetCreate="";
    #PermissionSetRead="";
    #PermissionSetUpdate="";
    #PermissionSetDelete="";
    #PermissionSetManage="";
    #PermissionSetApprove="";
    
    
    #* +++++++++++++++++++
    #*   runtime settings
        
    #* (only) kenaflow Cmdlets will throw Exceptions on failure 
    #*   ($true) or hide them ($false). In the last case the 
    #*   exception can be queried with Get-KFLastResult. Default 
    #*   is $true  
    #ThrowErrorsPreference = $true; 
    #* This is the default for the common PowerShell variable 
    #*   $ErrorActionPreference that controls the default 
    #*   PowerShell error handling. Default is "Stop". This can 
    #*   be overwritten by Invoke-Kenaflow -ErrorActionPreference 
    #*   <value> or in script using $ErrorActionPreference = <value> 
    #ErrorActionPreference = 'Stop';
    
    #* +++++++++++++++++++
    #*   debug settings 
        
    #* if not specified here the default setting from kenaflow 
    #*   will be used.  
    #writeMailsToDiskDuringDebug = $true;
    
    #* if not specified here the default setting from kenaflow 
    #*   will be used.  
    #alwaysWriteMailsToDiskInsteadSending = $false; 
    
    #* can be used to redirect all mails to the specified 
    #*   account(s)   
    #redirectAllMails = @(); 
    
    #* this parameter can be used to force client processes 
    #*   (--exec) to send PowerShell output serialzied to the 
    #*   main proces (--run) Default: $false
    #SendOutputToMainProcess = $false;
    
    #* this will dump RER file contents to the Log. 
    #DumpRerEventDataToLog = $false

    #* It is possible to save processed remote event files. 
    #*   Normally they are deleted. Saving can be enabled in the 
    #*   global configuration but must be also enabled for each 
    #*   workflow itself by setting this property to $TRUE. 
    #*   Default: $FALSE  
    #SaveRerEventsAfterProcessing = $false
}

if(!$kenaflow){import-module "<<directory>>\kenaflow.runtime.dll";Test-KFConfig;exit}

Discussion