[SalesForce] Controlling who receives workflow rule email alerts

Here's the scenario: I have set up a community where external users can create cases. When a case is commented on the creator of the case receives an email alert based off of the template I added to the community emails. This works. But in the org I also have an email alert which fires when a comment is added to a case. This email alert is supposed to send out emails to Case Owner, Record Creator, and Case Team based on a template for internal users only. The problem here is that the email alert workflow action cannot differentiate between "internal Record Creator" and "external record creator".

My solution: To write a trigger on the case comment that would check for the usertype of the record creator and then decides if an email alert should be sent or not.

However I am wondering if there's any other way of achieving this through configuration since it's best practice to use config instead of programmatical solution where possible.
Thanks.

Best Answer

If you don't want the email to be sent out at all when the Case was created by a portal user, you could add a constraint to check for the user type of the user that created the case in the workflow rule that triggers the email alert,.

E.g. make it a formula rule with the following formula (checking for the profile name of the user):

NOT(CreatedBy.Profile.Name  =  "High Volume Portal User")

If you have multiple profiles you could add them all, or check for the UserType. E.g. if you have a partner portal/partner community the usertype will be 'PowerPartner':

NOT(ISPICKVAL( CreatedBy.UserType ,"PowerPartner"))

If you want to email to be send out to the other recipients but not to any external Case creator, I'd suggest to

  1. create an additional Email field on Case (e.g. "Internal Record Creator Email"),
  2. create a additional Workflow Rule to only fill that field when the creator is internal (using the same logic as above), and
  3. add that email field to the email recipients in the original workflow.
Related Topic