function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LloydSLloydS 

Need Trigger to Change Case Status Based Upon Response - Willing to pay reasonable bounty

I need a trigger developed to autmoatically change the status of a case depending upon (primarily) who has responded - the customer or a support rep.

 

When the case is created, the status should be "New".

 

If the client adds a response (via email, self-service, etc.) and the status is "New", keep the status as "New". Otherwise, change the status to "Need to Respond".

 

If a support rep responds (by adding a public comment, email, etc.), the case status should be changed to"Waiting For Client Response".

 

I have a couple of additional status options which include "On Hold" - used by us to signify that the case is temporarily suspended but not closed, "Escalated" - used when the case has been escalated for an exec to review, and a couple of "Closed" options.

 

I'm not sure how complicated this is - I have no programming ability outside of HTML and some very basic PHP. I'd be willing to pay a small bounty just let me know.

 

Thanks.

paul-lmipaul-lmi
Depending on how many variations you need, you may actually be able to do this simply with Workflow Rules rather than a trigger.  I'd suggest you start there instead, as the spin-up time to get going with workflow rules is much shorter than undertaking development on a trigger.
sf11sf11

On the surface this doesn't look like a complicated logic, a combination of workflow and field update should be considered first before jumping into Apex trigger approach.

 

The help on workflow and field update sections are excellent source for learning.

 

Good Luck. 

bob_buzzardbob_buzzard

There are also plenty of people on these boards who will be prepared to help you along with this (as you've seen from above).  Read the docs, give it a try and if you hit problems, post what you've done and what's not working.

 

There's no need to start putting your hand in your pocket straight away! 

LloydSLloydS

Thanks for the feedback and encouragment. I've been trying to figure out how to do this using workflows but haven't quite figured it out. I've been using Salesforce for about two weeks so clearly I could be missing something in clear view. But so far, I haven't been able to find a field that I can base a workflow off of to change the field status. Basing it on when the case is modified doesn't work since adding comments or emails doesn't actually modify the case. Is there a particular field I should be looking at?

 

As far as documentation, if I do have to go down the Trigger path is there a particular document that would be most helpful. 

 

Thanks.

bob_buzzardbob_buzzard

Here's a couple of links:

 

http://blog.jeffdouglas.com/2009/04/20/writing-bulk-triggers-for-salesforce/ 

 

http://sfdcdownunder.blogspot.com/2009/02/how-to-write-trigger-in-apex.html

 

 

There's also the Apex Developer's Guide, but that might be a touch too deep for a first pass. 

LloydSLloydS
Thanks much. I did pick up the Developer's Guide and yes, a bit too much. I appreciate the help.
lahontilahonti

I know this is an old thread but since I don't see an answer I figured I would add one. I had to build this out today and couldnt find much on the web explaining how to resolve it.

 

As suggested in the other replies this can be accomplished using workflows rather than apex code. The one trick you need to be aware of is the workflow rule needs to be against the email message object rather than the case object. The workflow action will be against the case object. I have two rules essentially for when a rep sends an email and another for when a customer responds to an email.