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
tmbarrytmbarry 

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.
If(sd.address_bad__c==True){
    If(SD.Mailing_Address__c==SD.Address__c){

// 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) 
sfdcfoxsfdcfox

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()) ...