Workflow Status Codes

  • 12 November 2014
  • 4 replies
  • 43 views

Userlevel 7
Badge +17

Here are the workflow status codes which are required, for example, you want to filter a view on the workflow status. The status enumeration is defined by the SPWorkFlowStatus enum, within the Microsoft.SharePoint.Workflow namespace in the Microsoft.SharePoint assembly.

In case if you are retrieving the list values in a SQL Reports using the SharePoint provided web service you will get these status codes only and not the text values. Including exporting a list to Excel.

   

NumberMember nameDescription
0NotStartedThe workflow has not started.
1FailedOnStartIndicates that the workflow encountered an error when it started.
2InProgressWorkflow is currently in progress.
3ErrorOccurredAn error occurred during the execution of the workflow.
4StoppedByUserWorkflow execution was halted by a specified user.
5CompletedThe workflow is completed.
6FailedOnStartRetryingIndicates that the workflow is being retried after it failed to start.
7ErrorOccurredRetryingIndicates that the workflow is being retried after an initial failure.
8ViewQueryOverflowThis member is reserved for internal use and is not intended to be used directly from your code.
15MaxThis member is reserved for internal use and is not intended to be used directly from your code.

In addition, if you are using the OOTB Approval workflow then the return codes for this, as defined in the ReviewRoutingState enumeration within the Microsoft.Office.Workflow namespace (Microsoft.Office.Workflow.Routing assembly), are:

Canceled = 15

Approved = 0x10 (16)

Rejected = 0x11 (17)

Credit: Chanakya Jayabalan

Source: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowstatus.aspx

Workflow History List Event Types

NumberEvent TypeDescription
0NoneThere is no specific event type for this workflow event.
1WorkflowStartedThe workflow event concerns the workflow instance being initiated.
2WorkflowCompletedThe workflow event concerns the workflow instance being completed.
3WorkflowCancelledThe workflow event concerns the workflow instance being cancelled.
4WorkflowDeletedThe workflow event concerns the workflow instance being deleted.
5TaskCreatedThe workflow event concerns a workflow task being created.
6TaskCompletedThe workflow event concerns a workflow task being marked as complete.
7TaskModifiedThe workflow event concerns a workflow task being modified.
8TaskRolledBackThe workflow event concerns changes to a workflow task being rolled back.
9TaskDeletedThe workflow event concerns a workflow task being deleted.
10WorkflowErrorThe workflow event concerns the workflow instance generating an error.
11WorkflowCommentThe workflow event concerns a comment being written for the workflow instance.

Source: https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowhistoryeventtype.aspx


4 replies

Badge +7

Hi Andrew,

Great info! However I also need info about the meaning of different values of 'State' within the WorkflowInstance.State field in the database. Some records here have the value 64. Do you have info about the meaning of that?

Regards

Leif

Userlevel 7
Badge +17

I'm not seeing a lot of information on that structure. That seems to be an internal state value for synchronization within the service. It seems more of a .net use than a MS.SharePoint derived class.

Badge +1

In addition to this post I wanted to retrieve the WF status value for custom status. The easiest way I found is to create a new column (single line of text) and a new workflow:

Workflow

- request list > current item > (your WF)

- push it in a local integer variable

- update the column with the updated local variable.

This has been useful for filtering on a list with the WF status.

Userlevel 2
Badge +11

Would the Starting state have statenumber as well? If so, what would it be in order to check for them from a workflow.

Reply