0

Is there a FORMULA FUNCTION that is case sensitive? ISCHANGED(field) is not a case sensitive function I found from testing (Documentation is pretty vague on that). Is there a FORMULA Function that will work with for this or do I need to have this process builder use some APEX code where I know I can get this done?

4

String comparisons are almost always case-insensitive on the Salesforce platform. The only way I'm aware of to do case-sensitive comparisons in any context is the Apex method String.equals(). Even in Apex, the standard == operator is case-insensitive.

| improve this answer | |
  • 1
    You can get case-sensitive comparison in Apex via === as well, but has a silly restriction; you have to cast one of the strings to an Object: String a = 'hello', b = 'Hello', c = 'hello'; System.assert(a !== (Object)b); System.assert(a === (Object)c); This avoids the typical NullPointerException problem using String.equals. – sfdcfox May 29 '18 at 14:49
  • @sfdcfox does that work with values other than string literals? It seems at odds with the object identity semantics in the doc, but that's a new wrinkle to me. – David Reed May 29 '18 at 14:51
  • 1
    It's a trick unique to String values. It works because the system uses Java's String Pool implementation. When a string is constructed, the system checks to see if that string is already in heap, and if so, returns the existing string instead of using more memory. – sfdcfox May 29 '18 at 15:09
  • Ahhh. Got it. Objective-C does something broadly similar, but it only works with compile-time literals. (I never got into Java). Thanks! – David Reed May 29 '18 at 15:10

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.