Tuesday, September 28, 2010

Filter settings of Sharepoint view based on Approval status

Today I’m trying to create a view for clients with workflow enabled for a list. It comes up with this needs that filter the list based on “Approval Status”. Actually, we can find the “List Name Approval” from the Filter definition block for the view like below.

However, when we try to use “Approved/Pending/Rejected” as the “is equal to” value. It doesn’t work. I check the SDK and here is the definition of SPWorkflowStatus:

It’s still not matching the “Approval Status” in the list we use. However it does imply that the filter of “Approval Status” should be working based on enumeration integer value, rather than status string value.

A further research on MSDN forum, from the discussion of thread below:

Here are the integer values for Approval Status:

Rejected = 17
Approved = 16
Canceled = 15

As it states, this is coming from source code of “Approval Workflow Sample” in MOSS SDK. If you want to get a full list of “Approval Status” integer value list, here it is (from SharepointKB.org):

0 - Starting
1 - Failed on Start
2 - In Progress
3 - Error Occurred
4 - Canceled
5 - Completed
6 - Failed on Start (retrying)
7 - Error Occurred (retrying
15 - Canceled
16 - Approved
17 - Rejected

Hope it helps.

1 comment: