In my previous post (How to filter the Build Completion Event), I explained how to change the filter for the default Build Completion event that adds to the list of builds in Team Foundation Work Item Tracking fields like "Found In Build".

What I didn't give you were the actual filters that you probably need. But first, let's talk about the fields in the event that you can filter. The following list contains the fields and a brief explanation of what they represent.

BuildCompleteTime This is the time that the build finished as a string.
BuildMachine This is the build machine used to create the build.
BuildStartTime This is the time that the build started as a string.
CompletionStatus If successful this is "Successfully Completed". Other possible values include: "Failed" or "Stopped". This value may be localized!
Configuration This is the Build Type used to create the build.
Id This is the id of the build itself.
RequestedBy This is the name of the user that requested the build.
Subscriber This is the name of the user that installed this subscription
TeamFoundationServerUrl This is the URL of the server
TeamProject This is the Team Project that the build type lives in
TimeZone TimeZone for Start and Complete time
TimeZoneOffset TimeZone offset
Url This is the URL of the build

Event filters can use the following operators: =, <>, <, >, <=, >=

Filters can be combined using 'AND', 'OR', and parenthesis.

So, what about the filter strings? The most common filter string is the one used in the previous post. It included only builds that were successful:

"CompletionStatus"='Successfully Completed'

The next one that I have heard people ask for is to add in a specific Build Type name. In my example I want all successful builds that are created from the Nightly build type. That looks like this:

"CompletionStatus"='Successfully Completed' AND "Configuration"='Nightly'

The other thing I could imagine people wanting to do is exclude a particular build type. For instance, you may want to exclude your continuous integration build type because there are just too many builds being done. That would look like this:

"CompletionStatus"='Successfully Completed' AND "Configuration"<>'Continuous'

Those seem like the most interesting filters. If you have some other need, feel free to ask. To try these out use the attachment from my previous post and give them a whirl!