+ Start a Discussion

Comparing the values of two field in upper case

I need to compare the values of two text fields, one is always upper case, one is not.  How do I use the Upper() function in a trigger?


trigger Decide_Which_Address_to_Use on SD_Member__c (before update) {
For (SD_Member__c SD : Trigger.new){

// Determine if there is a bad address and which one it is.

// I tried this, but it didn't work // If(Upper(SD.Mailing_Address__c)==Upper(SD.Address__c)


Best Answer chosen by Admin (Salesforce Developers) 

It's called "toUpperCase()", not "Upper()" (that's a formula function).


So you can do this:


if(sd.mailing_address__c!=null&&sd.address__c!=null&&sd.mailing_address__c.touppercase()==sd.address__c.touppercase()) ...