Invoke-KFCustomDataEventSimulation

Syntax

Invoke-KFCustomDataEventSimulation 
  -Json <string>
  [-SimulatedUserName <username> (the current user)]
  [-SimulatedUserPassword <password> ("123")]
  [-MarkAsAuthenticated[:$true]] 
  [-Authentication <authentication-method> (Anonymous)]
  [-ThrowErrors[:$true]] 

Support

>= kenaflow 2.0.46

Return

An object of type kenaflow.EventDataSimResult:

public class EventDataSimResult
{
	public RemoteEventSource EventSource { get; set; }

	public object EventData { get; set; }

	public int OutputFormat { get; set; } = 0;
}

RemoteEventSource will have the value Unstructured for this cmdlet.

Description

This cmdlet is used to simulate a Remote Event to be able to debug workflow scripts in the event execution context.

Please read Debugging and Remote Event for details!

The cmdlet can only be used in a script block that is specified for parameter -EventData of cmdlet Invoke-Kenaflow.

The return object of this cmdlet is used by Invoke-Kenaflow to configure the runtime environment for kenaflow to execute the remote event.

"Custom Data" remote events are used to pass in JSON formatted data in the query string part of the URL with http "GET" method.

The object in the JSON input string MUST have the workflow id as property __wfid and the item id the event belongs to as property __itemid. BOTH properties are required! The rest of the object is "custom".

Parameters

-Json <string>

A Json formatted object.

[-SimulatedUserName <username> (the current user)]

This is used to simulate an authenticated request. It is passed to the script as part of the $eventData object. It is only used in case of 'Basic' authentication. See parameter -Authentication below. Default is the name of the current user.

[-SimulatedUserPassword <password> ("123")]

This is the simulated password for the authentication. Default is "123".

[-MarkAsAuthenticated[:$true]]

This can be used to simulate a not successful authenticated request. It is passed to the script as part of the $eventData object.

[-Authentication <authentication-method> (Anonymous)]

One of these values:

  • Anonymous (default)
  • NTML
  • Basic

In case of NTLM the current users credentials are used to simulate the request.

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

Import-Module "C:\Program Files\kenaflow\kenaflow.runtime.dll";

Invoke-Kenaflow -Debug -EventData {
    Invoke-KFCustomDataEventSimulation `
	    -Json '{"__wfid":"89525426-958f-4630-85bc-06cea78bafe3","__itemid":1,"customData":{"key":"value"}}' `
		-SimulatedUserName "sharepoint\ingo" -SimulatedUserPassword "kr@ftwerk" -Authentication Basic
}

Discussion