Exception RA Approved Workflow

ExceptionRAApprovalWorkflow (Rule)

Element properties:

TargetSystem.WorkItem.Activity.WorkflowTarget
CategorySystem
EnabledTrue
Alert GenerateFalse
RemotableTrue

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule Default
WA WriteAction Microsoft.EnterpriseManagement.SystemCenter.Subscription.WindowsWorkflowTaskWriteAction Default

Source Code:

<Rule ID="ExceptionRAApprovalWorkflow" Enabled="true" Target="ActivityManagement!System.WorkItem.Activity.WorkflowTarget" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">
<Category>System</Category>
<DataSources>
<DataSource ID="DS" TypeID="SystemCenter!Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule">
<Subscription>
<InstanceSubscription Type="$MPElement[Name='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ReviewActivity']$">
<UpdateInstance>
<Criteria>
<Expression>
<And>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property State="Pre">$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Id$</Property>
</ValueExpression>
<Operator>Like</Operator>
<ValueExpression>
<Value>EXRA%</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property State="Pre">$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Status$</Property>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$MPElement[Name="CustomSystem_WorkItem_Activity_Library!ActivityStatusEnum.Active"]$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property State="Post">$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Status$</Property>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$MPElement[Name="CustomSystem_WorkItem_Activity_Library!ActivityStatusEnum.Completed"]$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</Criteria>
</UpdateInstance>
</InstanceSubscription>
<PollingIntervalInSeconds>100</PollingIntervalInSeconds>
<BatchSize>50</BatchSize>
</Subscription>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="WA" TypeID="SystemCenter!Microsoft.EnterpriseManagement.SystemCenter.Subscription.WindowsWorkflowTaskWriteAction">
<Subscription>
<EnableBatchProcessing>true</EnableBatchProcessing>
<WindowsWorkflowConfiguration>
<AssemblyName>Microsoft.EnterpriseManagement.Notifications.Workflows</AssemblyName>
<WorkflowTypeName>Microsoft.EnterpriseManagement.Notifications.Workflows.SendNotificationsActivity</WorkflowTypeName>
<WorkflowParameters>
<WorkflowParameter Name="SubscriptionId" Type="guid">$MPElement$</WorkflowParameter>
<WorkflowArrayParameter Name="DataItems" Type="string">
<Item>$Data/.$</Item>
</WorkflowArrayParameter>
<WorkflowArrayParameter Name="InstanceIds" Type="string">
<Item>$Data/BaseManagedEntityId$</Item>
</WorkflowArrayParameter>
<WorkflowArrayParameter Name="TemplateIds" Type="string">
<Item>$MPElement[Name="ExceptionRAApprovalNotification"]$</Item>
<Item>$MPElement[Name="ExceptionRAApprovalNotification"]$</Item>
</WorkflowArrayParameter>
<WorkflowArrayParameter Name="PrimaryUserRelationships" Type="string">
<Item>$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='Exception!System.WorkItem.Exception']/Path[Relationship='Exception!System.ExceptionModifiedBy' TypeConstraint='CustomSystem_Library!System.User']$</Item>
<Item>$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' SeedRole='Target' TypeConstraint='Exception!System.WorkItem.Exception']/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemCreatedByUser' TypeConstraint='CustomSystem_Library!System.User']$</Item>
</WorkflowArrayParameter>
</WorkflowParameters>
<RetryExceptions/>
<RetryDelaySeconds>60</RetryDelaySeconds>
<MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>
</WindowsWorkflowConfiguration>
</Subscription>
</WriteAction>
</WriteActions>
</Rule>