This sample creates a Workflow in FIM (known to FIM as a WorkflowDefinition). The trickiest part of the WorkflowDefinition is the XOML property because it is usually large, and usually contains references to other objects.

Note the use of the Here-String in the sample below, along with the use of the -F operator (similar to String.Replace in .NET) to subsitute a reference into the XOML string.

### Create the Workflow: 'Congratulate New Craigs'
$xoml = @"
  x:Name                ="SequentialWorkflow" 
  ActorId               ="00000000-0000-0000-0000-000000000000" 
  WorkflowDefinitionId  ="00000000-0000-0000-0000-000000000000" 
  RequestId             ="00000000-0000-0000-0000-000000000000" 
  TargetId              ="00000000-0000-0000-0000-000000000000" 
  xmlns                 ="" 
  xmlns:x               ="" 
  xmlns:ns0             ="clr-namespace:Microsoft.ResourceManagement.Workflow.Activities;
                          Version=4.1.1906.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    x:Name              ="authenticationGateActivity1" 
    EmailTemplate       ="{0}" 
    To                  ="[//Target];" 
    CC                  = "{{x:Null}}" 
    Bcc                 = "{{x:Null}}" 
    SuppressException   ="False" />
"@ -F (Get-FimObjectID EmailTemplate DisplayName "Template for Craig")

New-FimImportObject -objectType WorkflowDefinition -State Create -Changes @{
	DisplayName 		= 'Congratulate New Craigs'
	Description        	= 'Because Membership Matters'
	RequestPhase 	   	= 'Action'
	RunOnPolicyUpdate	= 'False'
	XOML = $xoml
} -ApplyNow  

Last edited Aug 14, 2012 at 6:32 PM by CraigMartin, version 1


No comments yet.