I would like to create a "spam list" with some of the case subjects. My first idea was to create a custom object, with a field (set) where I can add the different "spam" subjects, a couple of methods, one to add subjects (a button in the "case" detail) and other to remove subjects from a list. And then create a trigger, which before insert/update a case, check the list, and close the case if the current subject is already on the list.

I don't really need more than one object, so I have been reading that maybe it's better to use a custom setting. but I have no idea.

Which option would be better?

  • Look, Custom setting is for the limited data and we use it so that we don't need to Query data and it's cached as well; May 1, 2017 at 13:38
  • How many subjects are you looking to blacklist? A Validation Rule might be better than any Apex solution here.
    – Adrian Larson
    May 1, 2017 at 13:41
  • The idea is that this spamlist would be dynamic, I mean when we receive a new case, if we think it's a spam case, we include its subject in the list. So can I do that just with a Validation rule?
    – manukadi
    May 1, 2017 at 13:45
  • You might want to choose door #3 here, and look into implementing some machine learning algorithm to do this for you. Classifying subjects as spam/not-spam seems like it would be a good fit for machine learning.
    – Derek F
    May 1, 2017 at 14:02

1 Answer 1


Another solution would be to try to build a text field (i.e. [Case].Case_Spam_Subects__c) associated with a workflow rule. The workflow rule can trigger off a checkbox (i.e. [Case].Mark_as_spam__c) which will append the [Case].Case_Spam_Subects__c text field with the tagged Spam Case subject line. That way you don't need to update your list manually and you can use the [Case].Mark_as_spam__c to update a third boolean formula field (i.e. [Case].Case_is_spam__c) when Contains([Case].Case_is_spam__c,Case.Subject).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.