For those who has been dealing with SM Authoring Tool, I believe you are familiar in Extending the Class and Form. But do you notice you cannot copy or extend the Workflow from an existing sealed MP ?
Below screen capture is from SM Authoring Tool showing the contents of Service Manager Change Management Library (a Sealed MP). What if we want to see how does the workflow look like ?
I come across a very good blog that tells how we could access to a sealed MP through SQL Queries.
DISCLAIMER: USING SQL QUERIES TO ACCESS SCSM CONTENT IS NOT SUPPORTED AND RECOMMENDED BY MICROSOFT. BE SURE YOU ARE WIDE AWAKE WHEN YOU ARE DOING THIS.
At the SCSM Management Server, launch MS SQL Management Studio. Connect to Database Engine and execute the query below
#SQL Query
Use ServiceManager
select MPName, CONVERT(xml,MPXML) from ManagementPack order by MPName
Now we can locate the MP that we want and noticed the column next to MP Name. Those are the Management Pack in XML !!! Click on it and you will get the entire MP contents in XML.
Now I can take a closer look on the Activity Status Changed workflow, and it looks as below
Activity Status Changed Rule
<Rule ID="ServiceManager.ChangeManagement.ActivityStatusChangedRule" Enabled="true" Target="System.WorkItem.ChangeRequest.InternalWorkflowTarget" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">
<Category>System</Category>
<DataSources>
<DataSource ID="DS" TypeID="Subscriptions!Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule">
<Subscription>
<InstanceSubscription Type="$MPElement[Name='CoreActivity!System.WorkItem.Activity']$">
<UpdateInstance>
<Criteria>
<Expression>
<Or>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property State="Pre">$Context/Property[Type='CoreActivity!System.WorkItem.Activity']/Status$</Property>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$MPElement[Name="CoreActivity!ActivityStatusEnum.Active"]$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property State="Post">$Context/Property[Type='CoreActivity!System.WorkItem.Activity']/Status$</Property>
</ValueExpression>
<Operator>NotEqual</Operator>
<ValueExpression>
<Value>$MPElement[Name="CoreActivity!ActivityStatusEnum.Active"]$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
<Expression>
<And>
<Expression>
<UnaryExpression>
<ValueExpression>
<Property State="Pre">$Context/Property[Type='CoreActivity!System.WorkItem.Activity']/Status$</Property>
</ValueExpression>
<Operator>IsNull</Operator>
</UnaryExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property State="Post">$Context/Property[Type='CoreActivity!System.WorkItem.Activity']/Status$</Property>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$MPElement[Name="CoreActivity!ActivityStatusEnum.Ready"]$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</Or>
</Expression>
</Criteria>
</UpdateInstance>
</InstanceSubscription>
<!--<StartWatermark>1</StartWatermark>-->
<PollingIntervalInSeconds>10</PollingIntervalInSeconds>
<BatchSize>100</BatchSize>
</Subscription>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="WindowsWorkflow" TypeID="Subscriptions!Microsoft.EnterpriseManagement.SystemCenter.Subscription.WindowsWorkflowTaskWriteAction">
<Subscription>
<WindowsWorkflowConfiguration>
<AssemblyName>Microsoft.EnterpriseManagement.ServiceManager.ChangeManagement.Workflows</AssemblyName>
<WorkflowTypeName>Microsoft.EnterpriseManagement.ServiceManager.ChangeManagement.Workflows.ActivityStatusChangedWorkflow</WorkflowTypeName>
<WorkflowParameters>
<WorkflowParameter Name="InstanceId" Type="guid">$Data/BaseManagedEntityId$</WorkflowParameter>
</WorkflowParameters>
<RetryExceptions />
<RetryDelaySeconds>11</RetryDelaySeconds>
<MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>
</WindowsWorkflowConfiguration>
</Subscription>
</WriteAction>
</WriteActions>
</Rule>
<Category>System</Category>
<DataSources>
<DataSource ID="DS" TypeID="Subscriptions!Microsoft.SystemCenter.CmdbInstanceSubscription.DataSourceModule">
<Subscription>
<InstanceSubscription Type="$MPElement[Name='CoreActivity!System.WorkItem.Activity']$">
<UpdateInstance>
<Criteria>
<Expression>
<Or>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property State="Pre">$Context/Property[Type='CoreActivity!System.WorkItem.Activity']/Status$</Property>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$MPElement[Name="CoreActivity!ActivityStatusEnum.Active"]$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property State="Post">$Context/Property[Type='CoreActivity!System.WorkItem.Activity']/Status$</Property>
</ValueExpression>
<Operator>NotEqual</Operator>
<ValueExpression>
<Value>$MPElement[Name="CoreActivity!ActivityStatusEnum.Active"]$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
<Expression>
<And>
<Expression>
<UnaryExpression>
<ValueExpression>
<Property State="Pre">$Context/Property[Type='CoreActivity!System.WorkItem.Activity']/Status$</Property>
</ValueExpression>
<Operator>IsNull</Operator>
</UnaryExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<Property State="Post">$Context/Property[Type='CoreActivity!System.WorkItem.Activity']/Status$</Property>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$MPElement[Name="CoreActivity!ActivityStatusEnum.Ready"]$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</Or>
</Expression>
</Criteria>
</UpdateInstance>
</InstanceSubscription>
<!--<StartWatermark>1</StartWatermark>-->
<PollingIntervalInSeconds>10</PollingIntervalInSeconds>
<BatchSize>100</BatchSize>
</Subscription>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="WindowsWorkflow" TypeID="Subscriptions!Microsoft.EnterpriseManagement.SystemCenter.Subscription.WindowsWorkflowTaskWriteAction">
<Subscription>
<WindowsWorkflowConfiguration>
<AssemblyName>Microsoft.EnterpriseManagement.ServiceManager.ChangeManagement.Workflows</AssemblyName>
<WorkflowTypeName>Microsoft.EnterpriseManagement.ServiceManager.ChangeManagement.Workflows.ActivityStatusChangedWorkflow</WorkflowTypeName>
<WorkflowParameters>
<WorkflowParameter Name="InstanceId" Type="guid">$Data/BaseManagedEntityId$</WorkflowParameter>
</WorkflowParameters>
<RetryExceptions />
<RetryDelaySeconds>11</RetryDelaySeconds>
<MaximumRunningTimeSeconds>7200</MaximumRunningTimeSeconds>
</WindowsWorkflowConfiguration>
</Subscription>
</WriteAction>
</WriteActions>
</Rule>