Links
Sometimes it is required to simplify workflows as much as possible. E.g. to reduce the amount of time that users have to invest in business processes. Some of these processes do not require complex forms to be filled out. Sometimes it's enough to give a simple answer to a simple question. Yes or no.
Therefore we created a very useful mechanism for kenaflow: "rich links" we call it.
They are generated with the cmdlet Get-KFLink
.
With it you can generate a complex ("rich") link with encrypted data in the query string protion of the URL.
The links contains:
- an optional validity timestamp and
- an optional metadata object^^.
The links can work asynchronous or synchronous.
"Asynchronous" means, that the user gets an simple answer in the browser that the request was received. The user does not get a result of the action itself.
"Synchronous" means, that the user gets a result from the workflow - as long as the workflow was fast enough to answer. This is because the workflow execution itself is always "asychronous" because of the architecture of kenaflow. It cannot be guaranteed to process a remote event in a very short period of time. Because remote events are queued and if the queue is long it may take a while until a remote event is processed.
The generated link can be send to a user e.g. in an email using out template engine (Templates) with Send-KFMail.
When the user clicks the link a browser opens.
In case of both "asynchronous" link remote events the user does only receive a generic answer in the browser that tells that the link event was received by kenaflow. (If the link is expired the user gets an information about the expiration.)
If the link is expired - if -ValidUntil
is set - the user get an immediate expiration answer. The HTML for this answer can be configured in the global configuration of kenaflow. It's currently not possible to configure this answer specific to the workflow because the workflow configuration _wfconfig.ps1
is not loaded at the point in time where the link remote event is received. If you want to implement you own expiration notice you can do that by your own. E.g. you use -Metadata
or Get-KFLink
and send the validity timestamp this way to the workflow.
In case of both "asynchronous" and "synchronous" link remote events the user does not get informed that the link did not cause any action (because of invalidity).
As already mentioned it is possible to send custom data to the workflow in a link remote event using parameter -Metadata
. It accepts a PowerShell Hashtable object that is serialized and encrypted in the link and is later available in the workflow as part of the $eventData
object in property __metadata
.
In the workflow the link remote events object in $eventData
has the following properties:
__wfid
: The workflow id.__itemid
: The item id the link remote event belongs to.__valid
: The "valid until" timestamp.__withAnswer
:true
if its a link remote event with required answer.__metadata
: The data ob the Hashtable specified in parameter-MetaData
ofGet-KFLink
.
Using Get-KFLink
it is possible to generate links for different workflows. Therefore you specify the workflow id with -WorkflowId
. BUT BE CAREFUL because the other workflow gets the ID of the currently processed item and will use this ID to process the item. If for example the other workflow is connected to another list the ID may point to the wrong item!
You can also specify a different list item than the currently processed one using -Item
.
You can simulate a link remote event for debugging using a script like this:
Import-Module "C:\Program Files\kenaflow\kenaflow.runtime.dll";
Invoke-Kenaflow -EventData {
Invoke-KFLinkEventSimulation -NTLM -SimulatedUserName "sharepoint\ingo" \`
-SimulatedUserPassword "kr@ftwerk" -ItemId 1 -WithAnswer -Metadata @{ "kenaflow"="cool"}
}