Introduction:
In this post we are going to see how to send email alerts for Case Comments using standard workflow email alerts.
As most of the salesforce developer's knows
- Though we can create Workflow Rules for Case Comments object, there is no option for choosing Case Comments object and its fields while creating Email Templates. So they will think that there is no option for sending email alerts for Case Comments using standard Workflow Email Alerts but this is not true.
Even though Case Comments fields are not available in the "Available Merge Fields" section in the Email Templates, we can manually enter Case Comments fields (in the standard merge fields formats) in the email templates, sf will automatically replace all these fields properly and send email alert to the specified email ids.
Create Email Template:
Create
sample email template for case comment notification. Assume the email
template name as "Case Comment Notification Template". While creating
email template you can specify case comment fields using the standard
merge field format {!CaseComment.XXXX}. For example, if you would like
to display the comment body then merge field would be
{!CaseComment.CommentBody}, like wise we can access all case comment
fields.
One more cool thing is we can also specify the Case fields. e.g: {!Case.CaseNumber}, {!Case.Subject} and so on...
Screen shot for reference
Create Workflow Rule and Email Alert:
Step 1: Create workflow rule for Case Comment object. Workflow Evaluation Criteria would be "Created".
Step
2: Add "New Email Alert" workflow action to the created workflow rule.
While creating new email alert choose already created email template "Case Comment Notification Template" and choose relevant recipients.
Note: Recipient could be any User / Customer Portal User / Public Groups / Roles.
Step 3: Activate the workflow rule.
Screen shot for reference
Testing Results:
Once
we are done with the above steps we are ready to receive case comment
notification. Below is my testing results. I have highlighted the merge
fields results for easy understanding.
Screen shot for reference
Disadvantages:
As
we all know here disadvantage is "We cannot send email alerts to
dynamic recipients". Since recipients are chosen statically i.e either
User / Public Group / Roles, there is no way to send email alerts
dynamically to any user related to Case and so on...
So
the scope of this facility is limited as of now, but if salesforce
starts supporting field creation in Case Comment then we will be all set
with this feature.
Yes,
I know until then we need some workaround for solving this issue which I
will be walking you thru in my next post "Email alerts to dynamic
recipients for Case Comments using Standard Workflow Email Alert in
Salesforce".