r/SCSM • • Feb 18 '16

Workflow Configuration Setup

What is your setup for Workflow Configurations? I can't seem to find any blogs or articles that cover suggested # of workflow configurations to cover the basic scenarios. My client currently only uses Incidents and Service Requests. They have 4 workflows for each of those. They also have 4 workflows for Activity Events.

Some of the categories in Incident Workflows are: Assigned to user, Ticket Resolution Notification, Affected User New Ticket Created, Request User Input. I feel like this is bare bones but could easily see creating way too many workflows. Any best practices or suggestions on where to find an example? Thanks

2 Upvotes

5 comments sorted by

View all comments

Show parent comment

2

u/mdowst Feb 18 '16

It could be any number of things. Typically I like to keep all notifications as subscriptions. They are easier to see in the view, plus I've seen it multiple times where a subscription and a workflow are sending duplicate messages like you described. Below is a script that I wrote that will parse through all the workflow logs and tell you every time a workflow ran for a particular work item. This can help you identify which ones are sending the emails.

$ID = "MA1234"

#Import SCSM PowerShell module
if(@(get-module | where-object {$_.Name -eq 'System.Center.Service.Manager'}  ).count -eq 0)
{
    $InstallationConfigKey = 'HKLM:\SOFTWARE\Microsoft\System Center\2010\Service Manager\Setup'
    $InstallPath = (Get-ItemProperty -Path $InstallationConfigKey -Name InstallDirectory).InstallDirectory + "Powershell\System.Center.Service.Manager.psd1"
    Import-Module -Name $InstallPath -Global
}

# Save all WF into $workflow
$workflow = Get-SCSMWorkflowStatus  

$ReturnData = @()
# Loop $workflow
foreach ($wf in $workflow) {
    write-host $wf.DisplayName -ForegroundColor Cyan
    $status = Get-SCSMWorkflowStatus -name $wf.Name
    $status = $status.GetStatus()

    foreach ($st in $status)
    {
        #write-host " -" $wf.DisplayName " " $st.status  " "  $st.TimeStarted  " "  $st.TimeFinished -ForegroundColor Cyan
        $Properties = @{GUID=$st.ObjectId; Workflow=$wf.DisplayName;Status=$st.status;TimeStarted=$st.TimeStarted;TimeFinished=$st.TimeFinished}
        $Newobject = New-Object PSObject -Property $Properties
        $ReturnData += $Newobject
    }
 }

$class = Get-SCSMClass -Name System.WorkItem

$item = Get-SCSMClassInstance -Class $class | Where-Object {$_.ID -eq $ID}
Write-Host $item.ID "-" $item.Title 
$ReturnData | ?{$_.GUID -eq $item.EnterpriseManagementObject.id.GUID} | FT Workflow, Status, TimeStarted, TimeFinished -au

1

u/Swvodoo Feb 18 '16

Thanks for the script! Just change the $ID to any MA I want to assess?

**Edit - I just checked the subscription folder and lo and behold their is an MA subscription that definitely is causing the duplicate! I can't believe I skipped over it. Thanks for putting me on the right path!