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
Parteek Goyal 3Parteek Goyal 3 

Unable to save ValidatedFromAddress field in EmailMessage trigger

Hi All,

I have written a trigger on EmailMessage object. I added a validation on From Address. below is the validation condition.
if(!email.FromAddress == '' && em.Incoming == false){
       System.debug('Testing Email');
       em.addError('Check From Email Address');            
It is working fine in Salesforce Classic but when I switch it to Lightining then it's not working as FromAddress is comming NULL.

I further Investegated it and found that we can use ValidatedFromAddress field for Lightning, this field is visible in field list of email Message but I am unable to save it in the trigger. I am not sure how to fix this isssue.