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
Jenny Chen 9Jenny Chen 9 

can not change email htmlbody in Apex trigger anymore, cache issue ??

Hello, 
I have an Apex trigger on a custom object, which sent an email message , it was working. but i need to change the htmlbody text due to user request. However, after i changed it to below. The emails continue to contain the old htmlbody that was before. only simple text changed. no change on link or others. I don't get it why. Please help. Thank you!

**************************************
String htmlBody='Dear '+p.Owner.Name+','+'<br/>'+'<br/>';             
                htmlBody+=o.Contact_Name__c+' from ';
                htmlBody+=o.Account_Name__c+test;
                
                htmlBody+=' has recently provided feedback'+','+'a full copy of which can be found at '+'<br/>';
                //htmlBody+='<a href='+Url1+'></a>'+'<br/>'+'<br/>';
                htmlBody+= URL.getSalesforceBaseUrl().toExternalForm()+ '/'+o.id+'<br/>'+'<br/>';  
                
                htmlBody+='Please review the survey feedback, including any comments, and follow-up with the customer. '+'<br/>';      
                     
                htmlBody+='<br/>';
                htmlBody+='Regards,'+'<br/>'+'<br/>'; 
                htmlBody+='Global Customer Advocacy'+'<br/>';

                String plainTextBody=htmlBody;
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                mail.setSubject(subject);
                mail.setHtmlBody(htmlBody);
                
                if (p.Owner.email!=null){
                    mail.setToAddresses(new String[]{p.Owner.email});    
                }
                   
                Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
VaasuVaasu
Why there are two varibales "O" and "P". And make sure you queried all fields before using them in the body.