FIM Request Details

A FIM Request has some key things that are useful for workflows.

Property Description
$fimwf.RequestID The GUID of the Request object in FIM
$fimwf.TargetID The GUID of the FIM object being acted on
$fimwf.ActorID The GUID of the FIM object that submitted the Request
$fimwf.WorkflowDefinitionID The GUID of the Workflow being executed
$fimwf.WorkflowDictionary The dictionary of items for the current Request phase

Accessing the FIM Request details

The FIM Request details are placed into the PowerShell runspace as a variable. Even though your script did not declare this variable, it is available to your script because the PowerShell Activity puts it there.

Accessing the FIM Request details is then as simple as this:

if (-not $fimwf)
{
    Throw "Failed to get workflow details from the FIM Request"
}
Write-Verbose "Processing FIM WF with Request Details: $fimwf"

Get the whole Request object:
###
### Load the FIM PowerShell Module
###
Write-Verbose "Loading the FIM Service Config Module from: C:\CodePlex\FimPowerShellModule"
Import-Module C:\CodePlex\FimPowerShellModule\FimPowerShellModule.psm1 -Verbose:$false

### 
### Get the Request
### 
Write-Verbose ("Getting the Request by ObjectID: {0}" -F $fimwf.RequestId.Guid)
$Request = Export-FimConfig -Custom ("/*[ObjectID='{0}']" -F $fimwf.RequestId.Guid) | 
    Convert-FimExportToPSObject 

Output the Request object to trace:
###
### Write-Verbose the Request details - this will end up in the WF DLL Trace Output
###    
$Request | Out-String -Width 100 | Write-Verbose

Save the Request object to XML:
###
### Save the Request details to a file for later
###
$Request | Export-Clixml -Path ("C:\Temp\RequestDetails.{0}.clixml" -F $fimwf.RequestId.Guid)

Get the Target object:
###
### Load the FIM PowerShell Module
###
Write-Verbose "Loading the FIM Service Config Module from: C:\CodePlex\FimPowerShellModule"
Import-Module C:\CodePlex\FimPowerShellModule\FimPowerShellModule.psm1 -Verbose:$false

### 
### Get the Target
### 
Write-Verbose ("Getting the Targetby ObjectID: {0}" -F $fimwf.TargetId.Guid)
$Target= Export-FimConfig -Custom ("/*[ObjectID='{0}']" -F $fimwf.TargetId.Guid) | 
    Convert-FimExportToPSObject 

Last edited Aug 14, 2012 at 1:06 AM by CraigMartin, version 2

Comments

No comments yet.