Communities Flow Service Cloud

Solved: New Post Notifications to Case Owners and Customers from a Support Community

Wow, it’s been a REALLY long time since I’ve posted on the blog! What a year 2020 was, and what a year 2021 is shaping up to be already. I really really want to focus on the blog this year and add more real use cases that help people solve their issues. I’ve got a lot of those because that’s what I do all day! Over the last few months, after talking about it for YEARS, my company finally has made the jump to Salesforce Communities. I was SO PSYCHED to implement this, and especially to implement a self-service support community, because Service is a big deal to me. It actually only took about a day to implement the community using the Customer Service template, but its a bunch of little stuff that is taking more time. Stuff that you would assume should be out of the box but just isn’t unfortunately. In this post I’m going to focus on one of the biggest head scratchers I’ve found: when you add a new post to the case using Chatter, the customer is not notified. And likewise, if the customer adds a new post to the case using Chatter, the case owner is not notified. Say what now?

I was SUPER confused about this at first. We are all so used to the behavior of Case Comments, I must have just been missing something. I frantically searched all the Community settings, Support settings, Chatter settings… I googled, I forumed, I communitied… and it’s just not a thing. It seems so crazy that this is not an out of the box feature, but it’s okay, because with the power of the Platform we can build this out ourselves. All those Chatter posts are actually part of an object called FeedItem, and we are able to access this in a Flow to do everything we need to do. So, let’s get started!

Flows for the Win!

I love Flow, and it seems Salesforce is pushing more and more into Flow instead of say Process Builder. You can also access the Feed Item object from Process Builder, and could probably get to the same solution there. But… Flow! To get started, create a new Flow. I chose to set this as a Record-Triggered flow, and am setting it as After Save. This way we don’t need to use Process Builder or anything else to launch our flow, it does this all by itself and behaves more like an Apex Trigger. For the object, you’ll select Feed Item, and since I’m setting this up specifically for my customer support community, I only want this to run on cases so I need to create a condition for that. I added a condition where the ParentId (the record the Feed Item is attached to) starts with 500, which is what all Case Id’s start with.

Next we’ll do a Get Records so that we can reference fields from our Case downstream and know things… like who the case owner is and stuff. So you’ll set the Object as Case and then we want to find the Case whose Id matches the ParentId of the record that triggered the flow. We’ll only want to save the first record, and I have it set to automatically save all fields because I wasn’t sure what I would want in the end, but you could probably get away with just saving the Contact and the Case Owner.

Okay, so now we have our record that triggered the flow and also all the case information that we need. Next, we’re going to do a decision. We may or may not need this. I chose to do different email templates depending on if it was the case owner posting or the customer, but if you were going to use the same email template for both cases then you wouldn’t need this step. But I did, so here it is! To determine is the Post was created by a Customer, I’m checking the Created By Id, and more specifically the Profile of that person and setting it to the name of my Community profile. I’m also doing a check here to make sure the Case has an Owner that is a User, not a Queue. I don’t want to send this email to a Queue. If you want to do that, just omit that second condition and continue on.

Updated: I ended up simplifying this logic to be $Profile.Name = Support Center User and {!Get_Parent_Case.OwnerId} starts with 005 (to see if its a User and not a Group).

To check if it came from an internal person, I’m using similar criteria but just saying that the Profile does not equal that Community Profile. I’m also checking here to see if the Post was made public. That is set on the Feed Item record and is easily checked.

Now we just need to send our email notification!

Send Better Email

Just a side not here, that I am not using the core Send Email action that comes with Flow. I’m using this amazing Send Better Email package from UnofficialSF.com. Without it, you can only send text emails and they are ugly and plain and boring. With it, I’m able to send HTML emails and take advantage of the Text Template resources from within Flow, and you can also use it to send Classic or Lightning Email Templates. So I recommend getting that for sure!

I used a Text Template with rich text to create my email body, and a plain text Text Template for my Subject Line. And here’s what the final Flow looks like. Its short, simple, and gives me just what I need to keep everyone productive and best: Posts don’t fall off the face of the Earth because no one knows they exist.

I hope this helps you or someone else as much as it helped me! Setting up Communities has been a blast and I really hope I can expand on this new knowledge this year to do more cool stuff with them! This Flow could also be used as a starting point for all Feed Item notifications. Instead of checking that the ParentId is a case in the entrance criteria, maybe make it the first decision – that way you can build out notifications for more objects and do other cool stuff! With Flow, the possibilities are nearly endless.

9 comments on “Solved: New Post Notifications to Case Owners and Customers from a Support Community

  1. Very good use case.

    Like

  2. Kristi! Thank you for this!! Was struggling to figure out how to send an email alert when a post to a case is made.

    Like

  3. You can send rich texts from the core email action, simply toggle ‘Rich text formatted body’ so it’s on and then add the value “{!$GlobalConstant.True}”. If you look at the code behind them a lot of Unofficial SF apps are not well built and can cause problems, always review the unmanaged code before proceeding.

    Like

    • Agreed, Ted! At the time, this was the best email solution for me, but in the past couple releases there have been great features for emailing from Flow where I wouldn’t have had to use this package at all.

      Like

  4. George Woods

    First…very helpful, thanks! I’ve implemented something similar and notice that notifications do not go out if a user comments on a post. From a database perspective, the post is stored as a FeedItem whereas the comment on that post is stored as FeedComment, so it does not trigger the flow. Have you run in to (and solved) this same scenario?

    Like

    • So I did have another person reach out about this same thing. You can’t access the FeedComment in the same way, but could potentially access it via apex and then use an apex action in your flow? The out of the box chatter notifications worked for replies to posts when I did this, so I didn’t setup anything additional here.

      Like

    • Hey @George – you can access FeedComments from process builder so if you want to keep your solution declarative, you could make the flow in this article an autolaunched flow and then launch it using a PB on FeedItem and another PB on FeedComment. Depending on your use case, you’ll have to run a Get to get the FeedItem record from the FeedComment but that should be fairly straightforward.

      Like

  5. Great article @Kristi – I had actually implemented this myself before seeing this and found this article while trying to make some improvements to our current flow. One thing I’ll note is that tou do run the risk of hitting the 5000 daily email limit using the Send Better Email action. Depends on volume but if you’re worried about this, you can instead use Email Alerts (though these come with their own limitations, especially when using Lightning email templates and certain merge fields).

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: