Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to figure out the best way to restart an errored out workflow.

A little background: We get seemingly random error-outs (error and stack below) in a visual studio created workflow when an item updates itself. This is very difficult to replicate, and my initial thoughts are that the workflow gets to the System.Update() step before the item is added to the database.

The fix is always very simple: cancel the workflow, and re-run it manually. I thought to just add these two steps to the error handler of the workflow, but I am wary of getting into an infinite loop of errors.

I thought about adding a counter to a hidden column, but in the off chance that the item is still not created in the database, then I would get an error from inside the error handler (SPD workflow inception XD).

We don't want to add a delay to the start of the workflow either as the System.Update() updates the color of the item and will probably cause more issues than the random error-outs.

Is there a better way to do this or an easier way to do this?

Error: Item does not exist. The page you selected contains an item that does not exist. It may have been deleted by another user.

Stack Trace:

at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) 
at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback) 
at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename) 
at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename) 
at Microsoft.SharePoint.SPListItem.SystemUpdate() 
at Attendance_Calendar.AttendanceCalendarWorkflow.onWorkflowActivated1_Invoked(Object sender, ExternalDataEventArgs e) 
at System.Workflow.ComponentModel.Activity.RaiseGenericEvent[T](DependencyProperty dependencyEvent, Object sender, T e) 
at System.Workflow.Activities.HandleExternalEventActivity.RaiseEvent(Object[] args) 
at System.Workflow.Activities.HandleExternalEventActivity.Execute(ActivityExecutionContext executionContext) 
at System.Workflow.ComponentModel.ActivityExecutor1.Execute(T activity, ActivityExecutionContext executionContext) 
at System.Workflow.ComponentModel.ActivityExecutor1.Execute(Activity activity, ActivityExecutionContext executionContext) 
at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) 
at System.Workflow.Runtime.Scheduler.Run() 
share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.