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 TypeReference.

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 selectCase 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