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.
|0||NotStarted||The workflow has not started.|
|1||FailedOnStart||Indicates that the workflow encountered an error when it started.|
|2||InProgress||Workflow is currently in progress.|
|3||ErrorOccurred||An error occurred during the execution of the workflow.|
|4||StoppedByUser||Workflow execution was halted by a specified user.|
|5||Completed||The workflow is completed.|
|6||FailedOnStartRetrying||Indicates that the workflow is being retried after it failed to start.|
|7||ErrorOccurredRetrying||Indicates that the workflow is being retried after an initial failure.|
|8||ViewQueryOverflow||This member is reserved for internal use and is not intended to be used directly from your code.|
|15||Max||This 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
|0||None||There is no specific event type for this workflow event.|
|1||WorkflowStarted||The workflow event concerns the workflow instance being initiated.|
|2||WorkflowCompleted||The workflow event concerns the workflow instance being completed.|
|3||WorkflowCancelled||The workflow event concerns the workflow instance being cancelled.|
|4||WorkflowDeleted||The workflow event concerns the workflow instance being deleted.|
|5||TaskCreated||The workflow event concerns a workflow task being created.|
|6||TaskCompleted||The workflow event concerns a workflow task being marked as complete.|
|7||TaskModified||The workflow event concerns a workflow task being modified.|
|8||TaskRolledBack||The workflow event concerns changes to a workflow task being rolled back.|
|9||TaskDeleted||The workflow event concerns a workflow task being deleted.|
|10||WorkflowError||The workflow event concerns the workflow instance generating an error.|
|11||WorkflowComment||The workflow event concerns a comment being written for the workflow instance.|
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?
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.
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:
- 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.