Authored by Zishan Razzaq

Monday, July 30, 2012

How to get the latest Case Comment on an Email Template/Alert

Hi everyone:

Recently, I was asked on how would one get the most latest case comment onto a Email Template for an Email alert to go out.
Of course as you know if you place in {!CaseComment.Comments} it will not work. No such thing.
So how do you do get the case comments to show in a email alert.

Solution:
Step 1:
   Create a new field on the Case Object. Name it whatever you want and make sure it is Text Area(Long) as an attribute for the field.

Navigate to:
Setup | App Setup | Customize | Cases | Fields | New Field
Create your new field make sure you select Text Area(Long) for the attribute.




Step 2:
Create a workflow rule off the Case Comment Object to update the new field.
Navigate to:
Setup | App Setup | Create | Workflow Rules & Approvals | Workflow Rules | New Rule



  1. Select Case Comment as the object
  2. Place in the Rule Name
  3. Select the first option:
  4. When a record is created, or when a record is edited and did not previously meet the rule criteria
  5. For criteria:
  6. Case Comment: Body is not equal to null

Click Save & Next.
Under Workflow Action Click on Field Update.
Place in a Name.
Field to Update, Select Case Object and select the new field that was created in Step 1.
Select Use a formula to set the new value
Place in the formula:
 CommentBody 
Click Save.
Click Done and Activate.
Final view of your workflow rule should look like:

Go to an existing case, create a new case comment.
The workflow rule should fire and update the new field.

Step 3:
   Now that we know it is working, lets go to an email template.

Place it the new field from the case object within that email template.

Now if you have an existing workflow rule that does Email alert as an workflow action for that rule, you should receive the latest comments on that email template now.


Thank you
I hope this helped.
Watch Me Fight 
Join My Facebook on Cage Assassin Fight Gear 
Like my fan page Cage Assassin Fight Gear