###
### Export request details and Workflow Data to a text file.
### Write an event with the message from [//WorkflowData/Message]
###
## Write the Request Details to a log file
if ($fimwf)
{
   “Request details: ” +
   ($fimwf | Out-String -Width 100) + “Workflow Data:`n” +
   ($fimwf.WorkflowDictionary | Out-String -Width 100 ) | out-file -FilePath “C:\demo\demo2\wfdata.txt” -Encoding “Default”
}
## Write the Message into the Event Log
if (-not $fimwf.WorkflowDictionary.ContainsKey(“Message”)) {Throw “WorkflowData parameter ‘Message’ was not found”}
Write-EventLog -LogName Application -Source PowerShellActivity -Message $fimwf.WorkflowDictionary.Message -EntryType “Information” -EventID 0