Invoking custom actions in Dovetail Carrier without using Task Manager

In my last post, I demonstrated how to create a custom action for Dovetail Task Manager – namely a GetStockQuote action.

Now, let’s see how we can invoke a custom action without using Task Manager at all.

We’ll invoke the same GetStockQuote code within Carrier, but, this has nothing to do with Task Manager. It’s simply a way to get Carrier to execute some custom code.

To invoke it, we’ll create a business rule, and have Rulemanager send this message into Carrier. (Recall that Dovetail Rulemanager version 2.0 added Carrier Message as a business rule action message type)



Here’s the overall process:




A New Carrier Message Type

Out of the box, Dovetail Task Manager fires a business rule with an action of Carrier Message.

The business rule action message content looks like:

taskSetName=Do Something Cool Task Set


Rulemanager turns this into an actual message, and sends it to Carrier.

Out of the box, Carrier only knows how to process these messages with a type of RunTaskSet. But, we can add custom handlers for our custom message types.


In this example, we’re using a custom message type, allowing Carrier to perform a custom action, completely independent of Task Manager.

Specifically, we’re using a  type of GetStockQuote, that will call a web service to get a stock quote. Carrier will simply log the stock quote returned from the service.

Our new custom message will look like:



Business Rule

As I mentioned earlier, we’ll create a business rule, and have Rulemanager send this message into Carrier.

Here’s the rule:

Object Type Case
Rule Name/Description get stock quote using log research
Start Events Log Research
Cancel Events None
Conditions Research Log Action Type = Stock Quote
Action Title Get Stock Quote
Create Activity Log Entry true (checked)
Who to Notify no one (leave empty)
Start Action 0 minutes
From Event Creation
Using Elapsed Time
Repeat Never
Message Type Carrier Message
Message type=GetStockQuote
symbol=[Research Notes]


What’s happening here:

When we do a log research on a case, and the log research type = Stock Quote, then send a message to Carrier, using the stock symbol from the research notes.

The use of Log Research is just a simple way to test this all out – you can fire a business rule on any of hundreds of events in the system.


Customize Carrier

Dovetail Carrier needs to be customized so that it knows what to do when it receives a Get Stock Quote message.

There’s 3 parts to this:

  1. Create a new class containing the information that we need to receive from Task Manager (i.e. the Symbol property)
  2. Map the Message. Messages must be mapped so that Carrier understands which message type we’re referring to. We can do this simply be creating a subcase of the MessageTypeRegistry class.
  3. Create a Consumer. We need to create a consumer for our new message. We can do this by implementing the Consumes<T>.All interface.

We have the freedom to do any logic we want within a consumer.

I’m not going to go into the specific C# code details here.

But don’t worry, we’ve made all the code available freely on Github:

And it’s really not much code to make this work.


Force the Business Rule to fire

Using Dovetail Agent

  • Open a case
  • Perform a Log Research
    • Set the Log Research Type = Stock Quote
    • Set the notes to a stock symbol, such as GOOG





The Case History shows the Log Research action, and then the Business Rule Action indicating that the business rule fired:




Review Rulemanager logs

Looking at the Rulemanager logs, we can see where it resolved the notes to get the stock symbol, and then published a message to Carrier:

RuleManager.StandardPropertyTokenExpansionService –
Property “Research Notes” using “focus_obj2act_entry:act_entry2resrch_log:notes” expands to “GOOG”

RuleManager.Carrier.MessagePublisher – Publishing
to msmq://localhost/dovetail.carrier


Review Carrier logs

Looking at the Carrier logs, we can see where it received the message, and then logged the result of the web service call:

Dovetail.Carrier.Core.RuleManager.RuleManagerConsumer – Carrier message received:

Dovetail.Carrier.Core.RuleManager.RuleManagerConsumer – Resolved message data for: Dovetail.TaskManagerExamples.MessageExample.GetStockQuote

Dovetail.TaskManagerExamples.MessageExample.GetStockQuoteConsumer – Alphabet Inc. is at 718.117493



All of the code for this example is available on Github:



So we can see that the business rule fired, Rulemanager pushed a message into Dovetail Carrier, and Carrier invoked some custom code.

And again, this is all completely independent of Dovetail Task Manager.

With custom code, actions can do whatever you want. In this example, we interfaced into another system (to get the stock quote).

What else could we do? How about:

  • When a contact is created in our system, create the same contact in SalesForce.
  • When a new order is (part request) is created, if there are any third party parts, make a web service call to the third party to order that part.
  • When a new case is created, post a message to the Support group chat system (Slack, Hipchat, Socialcast, etc.)
  • If no one has responded to a case within the contracted SLA time, update the case flag to indicate that the SLA was breached.
  • If an urgent case comes in after hours, make a web service call to pager duty
  • When a support rep emails a customer, automatically set the Initial Response flag on the case to True.

Really, the sky’s the limit here. We’ve opened up a whole new avenue for integrations.


Next up

You might notice that the above list of examples all start with an action happening within the Dovetail/Clarify system, and then we push a message into Carrier.

What if we want to push a message into Carrier from elsewhere? My next post will show how this can be done as well. Stay tuned.