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 




Sunday, July 8, 2012

SLA - Service Level Agreement Case Times

Hi:
   Scenario:
     Business wants to know the following:
  1. How many hours a case has been open?
  2. How many days a case been open?
All for SLA - Service Level Agreement amongst the business units who you support.

Solution:
We can utilize many methods, I will list out number of hours a case been open and number of days a case been open.

"DATEVALUE" <== a formula method that "Creates a date from its datetime or text representation"

To get the number of hours a case been open, we will not utilize "DateValue" but just common mathematical formula.
Let's say the 2 fields we are utilizing are CreatedDate and LastModifiedDate

Knowing there are 24 hours in a day worldwide... lets use that:

(24* (LastModifiedDate - CreatedDate  ))

 This formula will give you the number of hours between the 2 fields.

The Number of Days a Case been open:

Let's say you are utilizing a formula field which based on the type of case that comes in counts off the number of days SLA should meet for that case.

Lets say for "User Profile Change" type of case that comes in, the number of days to get back to the user is 1 day.

Field: SLA Expectations | SLA_Expectations__c | Attribute - Number (2,0) | Formula

Formula is:
IF(Type='User Profile Change',1,0)

Now we will use that field to figure out if the SLA was met or was it over 1 day.

Create another formula field named: SLA | SLA__c | Attribute - Number (2,0)

Formula is:
(DATEVALUE (CreatedDate) + SLA_Expectations__c) - TODAY()

This shall give you the result you need to figure out SLA which you can then set up an escalation rule to send out an email to the manager of operations let say that SLA was not met.

Great for reporting purposes as well :)

Thank you everyone
Hope this helped
Zishan