1

My workflow is set to automatically start when an item is created or changed. However, I automatically get "Error Occurred." If I manually start it, it works just fine. My workflow history seems to be ok. There are 3199 items with a limit of 20000.

Here is the error that I get:

Microsoft.SharePoint.SPException ---> System.Runtime.InteropServices.COMException (0x8102009B): 0x8102009b at Microsoft.SharePoint.Library.SPRequestInternalClass.AddWorkflowToListItem(String bstrUrl, Str

I can't figure out what is wrong.

2

Error code 0x8102009B mean Cannot create another thread.

So you have to check how you are calling the workflow, may be calling another workflow with your workflow or you are trying to start a new instance of a workflow, but the workflow is already running or is in error.

Remove the workflow instances, interrupting the flow of active and try again

  • It’s my primary workflow and it does call (or try to start) another workflow: If Secondary Workflow equals 2 Stop the workflow and log Secondary Workflow has already started. Else Start another workflow on Current Item, named Secondary Workflow Then Log Starting Secondary Workflow to the workflow history list – user29617 Jun 16 '14 at 20:59
  • so you have to check the logic, also is their any running workflow instance? – Waqas Sarwar MVP Jun 16 '14 at 21:00
  • The second one shouldn't start until the first one calls it. The second one makes the first one start again by pausing for 30 mins and then waiting for the first one to finish. I put a condition in the first one if it gets updated within 30 mins to stop the first workflow if the second one is already started in pause. – user29617 Jun 16 '14 at 21:07
0

I experienced the same error 0x8102009b when trying to programmatically restart my workflow.

The issue for me is that I was going through each SPWorkflow in the SPListItem.Workflows collection, canceling them and attempting to restart.

It turns out that all workflows ever run on the item are in that collection. I had to modify my code to filter for only running workflows to terminate and restart programmatically.

So basically, your code may be attempting to start a workflow that is already running or starting the workflow multiple times unintentionally.

Below is an excerpt of the code to filter for the workflows that are running and then restart them.

    //Check for running workflows
                                      List<Guid> workflowGuids = new List<Guid>();
                                      foreach (SPWorkflow workflow in item.Workflows)
                                      {
                                          string strWorkflowName = workflow.ParentAssociation.Name;
                                          if (strWorkflowName.ToLower().Contains("eww") || strWorkflowName.ToLower().Contains("travel"))
                                          {
                                              if (workflow.IsCompleted == false && workflow.StatusValue == 2)
                                              {
                                                  workflowGuids.Add(workflow.InstanceId);
                                              }


                                          }


                                      }


                                      foreach (Guid workflowId in workflowGuids)
                                      {
                                          SPList elist = eweb.Lists[listGuid];
                                          SPListItem eitem = elist.GetItemById(itemId);

                                          SPWorkflow workflow = eitem.Workflows[workflowId];

                                          Guid workflowAssociationId = workflow.AssociationId;
                                          Guid workflowBaseId = workflow.ParentAssociation.BaseId;
                                          string strWorkflowName = workflow.ParentAssociation.Name;



                                          //Terminate the workflow
                                          SPWorkflowManager.CancelWorkflow(workflow);


                                          SPWorkflowAssociation wfAssoc = eitem.ParentList.WorkflowAssociations.GetAssociationByName(strWorkflowName, System.Globalization.CultureInfo.CurrentCulture);
                                          wfAssoc.AssociationData = "";
                                          //Restart the workflow
                                          eitem = EWWTravelHelper.ReloadListItem(eitem);

                                          eitem.Web.Site.WorkflowManager.StartWorkflow(eitem, wfAssoc, wfAssoc.AssociationData, true);


                                          lblSignatureInfo.Text += ("<div style='color: green;'>Restarted the " + strWorkflowName + " workflow on item " + HttpUtility.HtmlEncode(eitem.Title) + ".</div>");

                                          ltlPendingTasks.Text = EWWTravelHelper.DisplayPendingTasks(eitem);
                                          lblSignatureInfo.Text = SignatureHelper.DisplayTravelSignatures(eitem, true);
                                      }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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