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
Ek0nomikEk0nomik 

Detecting where a case comment was created (explanation inside)

I was wondering if anyone had an idea of how I could go about solving this problem.  I have two websites, but only one API user (I'm not going to pay a monthly fee for another user strictly for API usage).  I want to setup workflow e-mail alerts as follows:

 

1. When a case comment is created on Site A, send an e-mail to some e-mail address.

2. When a case comment is created on Site B, send an e-mail to some other e-mail address.

 

Does anyone have any ideas for how I could detect where the comment was created from?  Salesforce doesn't let you create any custom fields on comments, so that won't work.  I can't base it on who created the comment since it's always the same API user.  Do I have any worthwhile options here?

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
Ek0nomikEk0nomik

Thanks for the responses Craig.  The cases are not site specific.  I had thought about going the custom object route, but (as you also mentioned) from a design perspective it's just going to be a mess.  I think until Salesforce lets you put custom fields on case comments I'll just avoid using Salesforce for this particular scenario.

All Answers

craigmhcraigmh

Are the cases themselves specific to each site?

 

If so, you could put a custom field on Case, and just query that.

craigmhcraigmh

You could also do this methodology, which would be horrible design-wise, but would work with how limiting Salesforce is:

 

Create a custom object with two fields, one for the CaseComment ID (you could even use Name for this), and one as an indicator of which system it came from.

Write a trigger so that when a CaseComment is inserted, it inserts a record into the custom object as well.

 

You won't be able to query off of this easily, but it will work.

Ek0nomikEk0nomik

Thanks for the responses Craig.  The cases are not site specific.  I had thought about going the custom object route, but (as you also mentioned) from a design perspective it's just going to be a mess.  I think until Salesforce lets you put custom fields on case comments I'll just avoid using Salesforce for this particular scenario.

This was selected as the best answer
craigmhcraigmh

Yeah, that happens a lot with Salesforce.

 

I've said this before to my manager:

"You know that point in the movies where the doctor said that he could lose his license for this? I do that every day with Salesforce."