Persisting Data
There are many ways to save data from a workflow and reload it for a subsequent workflow run.
File System
The workflow developer can save data himself in files in the workflow folder. It is up to him/her to do this or to choose this path.
Database
Any database system accessible from within PowerShell can be used by the workflow developer.
kenaflow Item Context Persistence
The following option is only available in SharePoint list workflows and state machine workflows.
kenaflow offers an easy way to save data in the context of the processed SharePoint list items and reload it later.
For this purpose, the workflow data list is used. This is a simple custom list, creates by kenaflow using program switch --createdatalist
. The data list must be named in the _wfconfig.ps1
workflow config file.
The data list contains a key column and two value columns, one for CliXML format and one for JSON format.
When using cmdlet Set-KFItemData
the workflow developer can serialize an object to the data list using a given key. The key is augmented with the unique list item id.
When loading the data later with Get-KFItemData
the same key must be used. (Only the CliXML column is read by kenaflow during reading!) It is again augmented with the unique list item id. The object is read from the data list and gets deserialized.
The workflow should clean up the data list using Remove-KFItemData
. Otherwise the data is never removed from the data list!
kenaflow Data Persistence
The following option is only available in SharePoint workflows (list, state machine and site workflows).
Data can be serialized to the workflow data list as CliCML and JSON with a key.
It can be used to exchange data between multiple workflow (if the share the same data list) or between different processed list items.
When using cmdlet Set-KFData
the workflow developer can serialize an object to the data list using a given key. The key is used "as is".
When loading the data later with Get-KFData
the same key must be used. (Only the CliXML column is read by kenaflow during reading!) (The key is used "as is".) The object is read from the data list and gets deserialized.
The workflow should clean up the data list using Remove-KFData
. Otherwise the data is never removed from the data list!
kenaflow SQLite Persistence
The following option is available in all workflow types.
It uses an SQLite database normally located in the program data folder of kenaflow. The location can be configured in the global configuration Section "Basic", key "database".
By using a key data objects can be written to the database using Set-KFDBData
, read from the database with Get-KFDBData
and removed from the database with Remove-KFDBData
.
The data is stored in CliXML serialized form in the database.
The data can be written/read/removed in context of the workflow which means that the workflow id is used additionally to the given key.
In case of SharePoint list and state machine workflows also the unique list item id can additionally be used.