REQUEST A DEMO

Use rule properties in your outgoing emails

Did you know you can use rule properties in your outgoing emails (log emails)?

I was recently asked this question, and I thought the answer was yes, but I wasn’t positive, so I decided to test it out (and of course document it here). Since you’ve read this far, you’ve probably figured out that the answer is Yes.

In this particular scenario, I simply wanted to include the case title in the email subject. By default, the subject of the email is Regarding Case Number XXX (where XXX is the case id number). Lets create a better email subject.

A little reminder before we get going – we’re talking about Log Emails that are actually sent out via RuleManager. No surprise, for my testing and usage, I’m using Dovetail RuleManager.

The send_email_about_obj template

When sending an email out, the send_email_about_obj com_tmplte is used.

This template typically looks like:

TO: <FOCUS.recipient>, <FOCUS.cc_list>

FR: <FOCUS.sender>

RE: About Case <ADDITIONAL_INFO>

<FOCUS.message>

Here’s what an email looks like to the recipient:

email1

So how do I get additional information in there?

Two simple steps:

  1. Create a rule property for the data you want
  2. Modify the template to include this data

Create a rule property

The key here is that the object type for this rule property should be email_log (schema id of 154)

Because it’s not a standard object type used in business rules, the Rule Property UIswon’t be of much help. Instead, create a DAT file and import it using DIET or dataex.

Here’s what the DAT file would look like:

OBJECT TYPE="prop_name", NAME="case title"
UNIQUE_FIELD=obj_type, prop_name
    FIELDS
        obj_type=154;
        prop_name="Case Title";
        path_name="case_email2case:title";
        subtype=0;
        val_type=0;
        max_len=1000;
    END_FIELDS
END_OBJECT NAME="case title"

Modify the Template

We’ll modify the template, adding the Case Title to the subject. As a reminder, rule properties are indicated by being wrapped in square brackets.

Again, we’ll use a DAT file to update the template. The DAT file can be imported using DIET or dataex.

Here’s what the DAT file would look like (notice the use of [Case Title] ):

OBJECT TYPE="com_tmplte", NAME="com_tmplte_268435465"
UNIQUE_FIELDS = "title"
    FIELDS
        title = "send_email_about_obj";
        flags = 144;
        action = "
TO: <FOCUS.recipient>, <FOCUS.cc_list>
FR: <FOCUS.sender>
RE: About Case <ADDITIONAL_INFO> : [Case Title]

<FOCUS.message>";
    END_FIELDS
END_OBJECT NAME="com_tmplte_268435465"

Now, when we send an email (using log email), it will include the case title. Here’s what it looks like:

email

Success! A better email subject.

 

DAT file

I’ve put my DAT file as a gist up on github: https://gist.github.com/704273

 

Rinse, Lather, Repeat

You can use this same strategy for including other dynamic data in your outgoing emails – including data from the case itself – or any data that can be traversed to via the schema starting from the email_log itself. This could include data from the case, contact, site, owner, support site, etc.

Hope this helps.