How to use Case Comments with Communities in the Service Console Feed View & Salesforce1

This past week I had someone who is looking to use Case Comments in the Service Cloud, but wanted it to be listed as an Action in the Feed.  I thought it would be a good use case of many different tools within Salesforce being used together.  I am looking at possibly doing this with code and basing it off this post, but for now I figured that I’de show you how without code.  Let me be clear that if you’re not using a Community that you can simply use the Internal Comments field instead without having to do anything.  The only negative of going with this solution is that you’re not going to have your Case Comment Chatter Post visible until your Chatter feed is refreshed, but that is something that also happens with the Internal Comments field.  The Case Comment record is visible instantly.  And this works nicely with Salesforce1.  With that said, let’s jump right in!

Automation Overview:

  1. Inputs for Case Comment received (Action)
  2. Process Builder triggered (Pass inputs into Visual Flow)
  3. Case Comment created in Flow

For this solution we have two different options in how we can do it architecturally:

  1. Record Create – Create new Custom Object
  2. Record Create – Create new Task Record
  3. Record Update – Use Custom Fields on Account/Opportunity

For me, because of not wanting to further complicate the Task Object and not wanting to add excess fields to the Case Object, I’m going to go with option 1 and create a new Custom Object.

How will we build this?

  1. Create the Case Comment Extension Object
  2. Create our Visual Flow to create the Case Comment
  3. Create our Process Builder to launch the Visual Flow
  4. Create our Action on the Case

For this solution we have two different options in how we can do it architecturally:

  1. Record Create – Create new Custom Object
  2. Record Create – Create new Task Record
  3. Record Update – Use Custom Fields on Account/Opportunity

For me, because of not wanting to further complicate the Task Object and not wanting to add excess fields to the Case Object, I’m going to go with option 1 and create a new Custom Object.

What fields do we need create in this Custom Object?

  1. Auto Number
  2. Case (Master-Detail)
  3. Comment (Long Text Area)
  4. Public (Checkbox) Note: this only applies if you have a Customer Community.

CaseCommentExtensionObject

Let’s get our Flow created first since we can’t Activate the Process Builder without it  (Setup | Create | Workflows & Approvals | Flows).

NewFlow.jpg

The first step is going to be grabbing our Record Create.

RecordCreate1.jpg

We now need to create the variables we will use to create the Case Comment.

Case Id

CaseCommentParentIdVariable

IsPrimary (This is a BOOLEAN, not Text)

CaseCommentIsPublishedVariable

CommentBody

CaseCommentBodyVariable

Lets make sure everything is correctly mapped inside our Record Create.

CaseCommentCreation

Great!  So lets hit OK and set this as our Starting Element.

SetAsStartElementCaseComment

Now lets drag in our Record Delete.  This is so that we don’t add useless data into Salesforce.

RecordDeleteDrag

Create a variable for the Record Id of the Custom Object record we just created, when our Action is used.

var_CaseCommentExtensionId

Map it in our Record Delete.

DeleteCaseCommentExtension

Connect the elements together to finish our Flow.

FinishedFlow

And lastly we want to Save and then Activate our Flow!

SaveCaseCommentFlow

ActivateCaseCommentFlow

Fantastic!  Now we need to setup our Process Builder that fires this Flow.  So lets go create a new Process Builder for this.  (Setup | Create | Workflows & Approvals | Process Builder)

CaseCommentExtensionPBCreation

We want the Process Builder to fire on our Custom Object that we created, Case Comment Extension, and we want it to fire only when a record is created.

CaseCommentExtensionPB1

We don’t need to set any criteria here, but to be safe let’s just make sure that we have a Case ID and Comment before proceeding.

CaseCommentExtensionPB2

Now we need to map the variables in our Flow to the Values in the Custom Object, using the Type Reference.

CaseCommentExtensionPB3

Hit Save, then Activate your Process Builder. Now, lets navigate to go create our Action.

CaseCommentActionNewButton

Keep it on the default, Create a Record, and select Case Comment Extension (our Custom Object we created earlier).

CaseCommentAction1

Let’s make sure we turn off the Create Feed Item, so we don’t spam the Chatter Feed since the Case Comment itself will cause a Feed Item to be created.  Also, make sure we add in a nice Success Message and custom Icon to make the action look sharp!

CaseCommentAction2

Remove the Case Field and drag Public and Comment into the Action’s Page Layout.  Make sure you require the Comment field.

CaseCommentAction3

It will give you a small popup warning you about not having the Case field on the Layout, but you can ignore it and move on.

CaseCommentAction4

We now need to setup a Predefined Field Value for our Case field.

CaseCommentAction5

Set Case.Id to our custom Case field.

CaseCommentAction6

Now all that is left is for us to update our layout(s)!

CaseCommentActionToLayout

And with that, lets take a look at the finished product!

CaseCommentAction.png

10 thoughts on “How to use Case Comments with Communities in the Service Console Feed View & Salesforce1

  1. ido greenbaum August 29, 2016 / 11:34 am

    Hi David,
    Thank you for posting this article.

    I am currently using the out-of-the-box ‘Internal Comments’ standard field, as part of a customized created ‘Update Case’ action, in my Case Feed.
    I’m trying to understand how the solution explained in this article is different then the out-the-box solution.
    I did see that the final resulting Action in this article has the ability to make a comment ‘Public’ (we are not using the Customer Portal so this is not a needed field for us), but wonder how this is different then simply adding the ‘Internal Comments’ to an existing Action.

    Thanks again for keeping this Blog, which is priceless.
    Ido.

    Like

    • David Litton August 29, 2016 / 12:42 pm

      Hey Ido,

      Yes Internal Comments works great and sync’s to the Case Comments. You technically could use add that field Public to the Case and use it as the value you’re basing the logic off of. But, then you’ve got to query and get the Case Comment Id to update and mark as Public, which then changes the order of operations slightly.

      Overall, yes, if you’re not using a Customer or Partner Community then you want to use the Internal Comments. I’ll make sure to spell that out further in my post, as this is more of a limitation around using it with an active Community.

      Thanks!
      David

      Like

      • ido greenbaum August 29, 2016 / 4:25 pm

        Thanks for the reply David.
        Looking forward to your next post around case feed. You have been super useful to us.

        Like

  2. Alan Kinsley August 29, 2016 / 2:47 pm

    Hey David! I am getting an error when the record is created in the Flow:

    An error occurred at element Create_Case_Comment (FlowRecordCreate).
    INSERT — INSERT FAILED — ERRORS : (MALFORMED_ID) ParentId: id value of incorrect type: ””,

    Flow Details
    Flow Name: CaseCommentExtensionCreation
    Type: Autolaunched Flow
    Version: 2
    Status: Active
    Flow Interview Details
    Interview Label: CaseCommentExtensionCreation 8/29/2016 9:45 AM
    Current User: Alan Kinsley (00570000004kAvQ)
    Start time: 8/29/2016 9:45 AM
    Duration: 0 seconds
    How the Interview Started
    Alan Kinsley (00570000004kAvQ) started the flow interview.
    RECORD CREATE: Create_Case_Comment
    Create one CaseComment record where:
    CommentBody = {!var2_CaseCommentBody} (null)
    IsPublished = {!var_IsPublished} (null)
    ParentId = {!var_CaseId} (null)
    Result
    Failed to create record.
    ________________________________________
    Error Occurred: INSERT — INSERT FAILED — ERRORS : (MALFORMED_ID) ParentId: id value of incorrect type: ””,

    Like

    • David Litton August 29, 2016 / 3:05 pm

      Alan,

      What is the Input/Output type for your variables? They all are listed as NULL, so I am assuming that you’re variables are set as Private and not Input Only or Input & Output. So right now you’re trying to create a Case Comment without a Case ID attached, which is causing that error.

      That should be a change in your Flow as opposed to your PB (assuming the variables are mapped correctly there).

      Thanks,
      David

      Like

      • Alan Kinsley August 29, 2016 / 3:58 pm

        I got it to work! It was something I had configured wrong with the PB.

        However, it is not creating a Feed Item now when I create a Case Comment using the Quick Actions. We want it to create a Feed Item.

        Like

      • Alan Kinsley August 29, 2016 / 4:20 pm

        Alright…The Case Comments are appearing in the Feed in the Sandbox. However, I pushed it to Prod and they are NOT showing up in the Feed in Production. I haven’t changed any settings between Sandbox and Prod. What can be causing this issue?

        Thanks!
        Alan

        Like

      • David Litton August 29, 2016 / 4:45 pm

        Alan,

        By default that should be happening. Have you refreshed your view after you use it?

        The Feed Item won’t show up until after that happens. You’re creating a Case Comment with your Action, and it should by default be creating a Feed Item in your Case Feed unless you have it filtered out your console for some reason.

        Like

  3. Alan Kinsley December 1, 2016 / 7:29 pm

    Hey David,

    Case comment notifications are not sent when the comment is created in Feed, via the Flow I created. However, they are being sent when created in the Detail view via the Case Comments Related List.

    Do i need to add something to my flow?

    Thanks!

    Like

    • David Litton December 12, 2016 / 5:55 am

      The comment should create a feed item by itself. Are you sure the page has been reloaded? The Flow won’t automatically reload it the way it is currently setup in this post.

      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 )

Google+ photo

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

Connecting to %s