Watching cases in Dovetail – 2014 edition

A couple of years ago I posted about watching cases in Clarify / Dovetail. The idea is still a good one, and I’ve recently combined the idea of watching a case with the new tagging functionality that’s available in Dovetail Agent 5.


It’s not uncommon that we want to keep up with what’s going on with certain cases – specifically cases that are being worked by others.

For example, a high priority case for a new customer may have been recently created, and even though its being worked by someone else, I still want to keep abreast of what’s happening with it. Or perhaps the customer I’m going to visit next week has a case open that I want to stay in the loop on. Or I want to follow how one of my guys is dealing with a difficult customer.

The concept is that we can “watch” a case. This means we can indicate that we want to stay in the loop with what’s happening on these watched cases.

The run down

We’ll use the built-in tagging functionality in order to watch a case. Specifically, we’ll use a tag of “watch”.

We already provide an easy way to query for tagged cases within the Dovetail Agent application.

We’ll send the user a daily email with the recent activity on their watched cases. Imagine that you come into work every morning, and you have an email waiting for you that summarizes the recent activity of the cases that you’re watching. In addition, we’ll include watched cases that have not had any recent activity.


Watch a case

Simply add a tag of “watch” to a case. The case can be owned by you or by someone else. The case can be closed or open. Doesn’t really matter.



Query – Cases I’m watching

This is a simple query with 2 filters:

  • Tag Name = watch
  • Tag Owner = me


This query makes it easy to view all of your tagged cases from within the Dovetail Agent application.


Email – watched cases report

The search result is nice, but that means I would need to remember to go into the app every day and review my watched cases.

Instead, lets simply send the user an email that rolls up all of the recent activity on their watched cases.


The email shows me each of my watched cases that have recent activity, along with a case summary (customer info, owner, title, condition, and status), and the actual recent history activities.

It also shows cases that do not have any recent activity – which is perhaps even more important that ones with activity.

The case number is a hyperlink that launches you directly to that case in Dovetail Agent.

So now, every morning, in my inbox, is an email rolling up all of the recent activity on my watched cases. Sweet!


Technical Details


I added a new view that joins tag, user, case, and act_entry, which will make it easy for me to find activities on watched cases within a certain time period.



Dovetail Web Service

I’m using the histories view web service from Dovetail bootstrap, which returns the history items for multiple objects. In addition, it takes a SINCE parameter, which allows us to just get history items since a certain date.

If the script runs on a Monday, I get all activity since Friday. Else, I get activity since yesterday. The script currently doesn’t run on Saturday or Sunday.

Mailchimp Web Service

I’m using CSS to style my HTML email nicely. But, many email clients don’t support external stylesheets. So, the best practice here is to in-line the CSS.

The cool kids over at MailChimp provide a nifty tool for doing this. And, even better, they provide a web service API for doing this.

Powershell script

Now, I just needed a script to pull it all together.  The main part of the script explains it:

$results = GetWatchers | GetWatchedCases  | GetCaseHistories | ParseJSONIntoHTML |  GetWatchedCasesWithNoActivity | InlineCss | SendEmail;

Get the list of users who are watching cases (that have been modified recently), then get the list of watched cases for each user, then get the recent case history items for these cases (using the web service), turn that JSON result into some nice looking HTML, get the watched cases with no activity, inline the CSS with the HTML, and then send that as an email.

Scheduled Task

Finally, we’ll setup a scheduled task to run our powershell script daily.


Now, every morning, the script will run and email a report of recent activity on the watched cases out to the users.

Show me the code!

I’ve shared all of my code on Github:

It’s free to use and enjoy.

Hope you find this useful.

Rock on.