REQUEST A DEMO

Yank Notifications via Email

Clarify’s Business Rules + RuleManager is a pretty robust and generic event processing system. Admins/BAs configure rules for who to notify and when, and each user can even decide how they want to be notified (email, pager, within the app itself (the Integrated Notifier), etc.). Most of us here at Dovetail use email as our notification preference. I don’t believe any of us the integrated Notifier.

There has always been one desired business rule that I couldn’t make work with the existing Clarify infrastructure – yank notifications by email.

Note: in later versions of Clarify, Yank has been renamed to Retrieve. After many years of snickering over the term Yank, it’s just now a natural part of my vocabulary.  But I digress…

For example, if someone yanks a case from me, I would like to get notified that it happened. And I want the notification to be via email.

For example:

Rule Name: Yank Notification
Object Type: Case
Start Event: Yank
Conditions: None
Notify: [Previous Owner]
Message: [Object Type] [Object ID] has been yanked from you by [Current Owner]
Repeat: No

One would assume that this would be a simple business rule. One would be incorrect. The problem with implementing this as a business rule is that there is no data that holds onto the previous owner.

Clarify’s solution to this is to have the Classic Client always send an integrated notifier message (insert into table_message). Which is fine if you use the Notifier; worthless if you do not.

As we use email as our notification preferences here at Dovetail, I wanted this to always send an email. Yes, I do realize that this is just another hard-coded delivery option, as opposed to a generic solution, but that’s why the title of this post is "Yank notifications via email", not "Yank notifications via user preferences". Hey, it works for us here. If this doesn’t work you, well, thanks for reading this far.

Of course, we use our own fcClient as opposed to the Clarify Classic Client, so implementation became fairly easy. Within the Yank action page (/workflow/action2.asp), I added:

var curr_owner_email=getCurrentOwnerEmail(strObjectType,ObjectIdNumber);
var prettyName=getPrettyName(strObjectType);
var subject = ‘Yank Notification. ‘ + prettyName + ‘ ‘ + ObjectIdNumber + ‘ was yanked from you by ‘ + FCSession(‘user.login_name’);
var msg = ‘The following object was yanked from you by ‘ + FCSession(‘user.login_name’);
msg+= ‘ (‘ + FCSession(’employee.first_name’) + ‘ ‘ + FCSession(’employee.last_name’) + ‘) ‘;
msg+= ‘: ‘ + prettyName + ‘ ‘ + ObjectIdNumber;

YankObject(strObjectType,ObjectIdNumber,strWipbin);

if (curr_owner_email.length > 0){
   SendEmail(curr_owner_email,msg,subject);
}

Notice that we get the user to be notified before the case is actually yanked. Pretty simple. There are a few helper functions used:

getCurrentOwnerEmail : Get the Email Address of the Current Owner of the Case (or whatever object we’re dealing with). We only use cases, solutions, and CRs here.

function getCurrentOwnerEmail(obj_type,id){
var email=”;
var rel=”;
if (obj_type=="case"){rel=’case_owner2user’;}
if (obj_type=="probdesc"){rel=’probdesc_owner2user’;}
if (obj_type=="bug"){rel=’bug_owner2user’;}
if (rel==”){return email;}

var genObject=FCSession.CreateGeneric(obj_type);
genObject.BulkName=’action2.asp’;
genObject.AppendFilter(‘id_number’,’=’,id);
var genUser=FCSession.CreateGeneric(‘user’);
genUser.TraverseFromParent(genObject,rel);
var genEmployee=FCSession.CreateGeneric(’employee’);
genEmployee.TraverseFromParent(genUser,’user2employee’);
genObject.Query();
if (genEmployee.Count() > 0){
   email=genEmployee(‘e_mail’)+”;
}
genObject.Bulk.RemoveAllGenerics();
return email;
}

getPrettyName : Translate a database object name into a user friendly name

function getPrettyName(strObectType){
switch (strObectType){
case "case":
return "Case";
break;
case "’probdesc’":
return "Solution";
break;
case "bug":
return "Change Request";
break;
default : return "";
}
}

SendEmail : Send an emeil

function SendEmail(recipient,msg,subject){
var sender = Server.CreateObject(‘FCEmailSender.Sender’);
sender.FromAddress = "Dovetail Software <dovetail@dovetailsoftware.com>";
sender.To = recipient;
sender.SetSmtpServer("smtp_server_name", "25", null, null);
sender.Subject = subject;
sender.Body=msg;
sender.Send();
sender=null;
}

Notice that the SendEmail function uses a COM object: FCEmailSender. This was simply a .NET object that we added a COM wrapper to for sending email. There are plenty of free components out there if you don’t want to create your own.

I threw the 3 helper functions into a .js file and then simply included in on action2.asp.

That’s it. Pretty simple. Now whenever an object is yanked in our system, the previous owner is notified by email.

This problem could be tackled another way as well, by keeping track of the user that the object was yanked from. This could be a new relation from user to each object type (bug, case, subcase, etc.). Then this relation could be populated when a Yank occurs, then this data could be used as a new business rule recipient alias. Always more than one way to skin a cat.

Hope this helps. Have fun!