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?

0

2 Answers 2

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.

4
  • 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
    Commented May 29, 2018 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
    Commented May 29, 2018 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
    Commented May 29, 2018 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
    Commented May 29, 2018 at 15:10
0

This is an old post, but figured I'd share in case it helps others. You have a couple options with formula fields and flow:

Use a Boolean formula field to say record field 1 != record field 2, which can then be applied to decision nodes. Example: {!$Record.PersonMailingCity} != {!$Record.PersonOtherCity}

I believe the FIND() function is case sensitive. So you could say find field 1 in field 2 conceivably. I think the first option is a little easier to follow though.

You must log in to answer this question.

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