I am planning to have a workflow in SharePoint 2013, run a weekly loop from start to end dates. This will run fine normally. However how about when the process stops due to like the server going down. Thus what do you do in that case?


  1. How do you detect when that kind of error occurs? How do you write to log file and/or send out a email if that is possible.

  2. How do you restart the process from when the process stopped executing at?

All I know is that you can set the process to be manually started.

1 Answer 1


You can do this whith powershell:

Start a workflow:

Add-PSsnapin Microsoft.SharePoint.PowerShell
$SPAssignment = Start-SPAssignment
$web = Get-SPWeb "http://YourSharePoint/Site"
$site=Get-Spsite "http://YourSharePoint"
$list = $web.Lists["Your List"]
foreach($item in $list.Items)
        $culture = [System.Globalization.CultureInfo]::InvariantCulture
        $association=$list.WorkFlowAssociations.GetAssociationByName("Worklflow Name", $culture)

Stop-SPAssignment $SPAssignment

And to monitore workflow status (SharePoint Online):


 Function GetWorkflowStatus([Microsoft.SharePoint.Client.List]$list,[int]$listItemId, [string]$workflowName)
     $context = $list.Context
     $listItem = $list.GetItemById($listItemId)
     $workflowStatusField = $listItem.ParentList.Fields.GetByTitle($workflowName)
     if ($listItem.FieldValuesAsHtml[$workflowStatusField.StaticName] -ne $null)
         $statusValue = $listItem.FieldValuesAsHtml[$workflowStatusField.StaticName]
         Write-EventLog -LogName Application -Source 'Application Error' -Message $statusValue -EventId 2337 -EntryType error;
     return $null

See the erros codes of workflows.

  • My company uses SharePoint in the cloud. Thus would I need to write code like you suggested? If I do need to write the code, can I just use a tool, change some settings, change a config file without writing code? Jan 13, 2015 at 16:49
  • I recommend doing with powershell. You will probably need to write code. Jan 13, 2015 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.