THE PROBLEM
In the “Status” picklist field of the Case Object, we have defined a “Waiting on Customer” value.
If a Support Rep is working a Case on behalf of a Customer, they'll often come to a point where they can progress no further -- without additional diagnostic or support information from the Customer. When this happens, they'll contact the customer, let them know what information is required, and change the Case Status to “Waiting on Customer”.
When the Customer provides the information, either through the Self-Service Portal, or through an email, the Case Status remains “Waiting on Customer”. Naturally, this frustrates the Customer! When they review their open cases through the Self-Service Portal, they expect to see this status field updated. The Case is no longer waiting on Customer, it's waiting on us!
My Support Team wanted a Workflow rule that would automatically change the Case Status from “Waiting on Customer” to “Investigating”, whenever the customer added a Case Comment through the Self-Service Portal, or if they send in an email related to the Case (to our email2case application).
When I reviewed the Release Notes for Winter'09, I knew this functionality -- the ability to create a workflow rule on Case Comments -- had been recently added in. But as I started playing with the rule criteria in my sandbox, I got stuck. How do determine if a Case Comment was added by a Self-Service Portal user?
THE SOLUTION
A quick search on the Salesforce Community forums gave me this helpful information.
As len123 observes, every user has a type – but Customers accessing through the Self-Service Portal are not “users” (i.e., no user license required). Therefore, any Case Comment added by entities in which the $User.UserType is NULL must originate from Self-Service Portal users.
My first Workflow Rule formula looked like this:
AND (
ISPICKVAL (Parent.Status , "Waiting on Customer"),
ISPICKVAL ($User.UserType , "")
)
Every time a new Case Comment is added, this workflow rule is evaluated. If the related Case status is “Waiting on Customer” AND the $User.UserType is null, go do some action. In my case, the action was changing the related Case Status to “Investigating”.
The Workflow rule worked great. If the Case Status was something other than “Waiting on Customer”, the workflow never triggered. Of if an Internal user added a Case Comment (no matter what the Case status was), the workflow would not trigger.
But some of our customers communicate with our Support organization through email. We have custom Apex application that processes these emails, looks for a certain tags in the email subject line, and finds the Case that email is related to. The app adds the email to the case, and copies the body of the email into a Case Comment. The Support team wanted to make sure these customer updates would trigger the same workflow.
Here is the final Workflow Rule that I implemented:
If that’s hard to read (click to enlarge), the rule criteria formula text block is below:
AND (
ISPICKVAL (Parent.Status , "Waiting on Customer"),
OR (
ISPICKVAL ($User.UserType , ""),
$User.Username = "mail2case@cedarpointcom.com"
)
)
Now, the Workflow rule fires only when Case Status is “Waiting on Customer” AND one of the following is true: 1) UserType is Self-Service Portal user, or 2) case comment was added by our Apex app (which adds the body section of the email to the Case Comments.
What workflow rules have YOU implemented with Case Comments since Winter'09?
PS – Thanks to Twitter follower @CRMFYI for the good tips, and len123 for the workflow formula!
Nice one, JP!
ReplyDeleteDid you see they've started supporting the use of && and || instead of the (to me) awkward AND's and OR's?
With that, your last rule criteria formula would look something like this:
ISPICKVAL (Parent.Status , "Waiting on Customer") && (ISPICKVAL ($User.UserType , "") || $User.Username = "mail2case@cedarpointcom.com")
To me that feels more intuitive, both to read and write. I'm sure you can use indentation and stuff as well, if you want to.
Thanks allot!
ReplyDeleteThis is really helpful