0

I need users to use a JavaScript custom button to create a Case Comment because the button will also update the Case Status and also, change the Stopped field from TRUE to FALSE or vice versa (I'll create two buttons, one for each Stopped value).

Those additional field updates (which will be made by the JavaScript code, if possible) should only be made when a comment is added for a particular reason. The rest of the time, I don't want them to be made.

I want to use a button so that it can be added to the Case page layout, where it is more visible than a tick box. The other issue with a tick box (which seems like the most obvious alternative) is that the user would need to remember to tick it before adding the comment.

But I can't find any examples of JavaScript code which create a Case Comment. Is this possible?

1 Answer 1

1

You want to use Flow for this...??

Create a Flow that grabs the CaseId, then you can create a new CaseComment by making the CaseId the ParentId. You can make it isPublished if you so choose, and send off a custom Email Alert within the Flow if you want to give them notification options. Also, you can easily throw a "Decision" element in the mix to have it make the Stopped field change for you. You could do this all within a screen really easily, or you could have it run based on fields already on your Case.

This example should give you exactly what you need for the Button URL, and then just make the rest happen in your Flow: http://goo.gl/Zt33dM

5
  • Thanks, I'll have a go at this tomorrow and feedback then.
    – Alex S
    Commented Jun 6, 2015 at 15:59
  • I'm struggling to work out how to insert the Case Id from the URL into the Parent Id for the new Case Comment. Following your guide I've created this URL - ../flow/Information_Requested_Case_Comment?var_CaseId={!Case.Id}, created a Screen element as the start, then added a Record Create element with the ParentId set to the new variable, from my URL, CaseId. I get an error 'unhandled process fault..Parent Id of incorrect type "" '?
    – Alex S
    Commented Jun 8, 2015 at 15:45
  • Hey Alex, can you tell me the variable you are using in your Flow? If your variable is CaseId then you dont have it mapping correctly. The variable I have in my Flow is "var_CaseId". Its the naming convention I use for my Flows so that I know what I am looking at. If that isnt the issue, I'de love to setup a screenshare or something to figure it out with you. Commented Jun 9, 2015 at 2:04
  • Thanks David, yes CaseId is the variable that I'm using in the Flow. I've tried removing the "var_" in the URL and I'm getting the same error. Is that the part which you thought I'd got wrong? If we could do a screen sharing session, that'd be great.
    – Alex S
    Commented Jun 9, 2015 at 5:31
  • Alex, shoot me a msg - [email protected] Commented Jun 9, 2015 at 17:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .