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
Sandeep Rahul PVSandeep Rahul PV 

Getting Null in Trigger Not from SOQL query

Hi Team,

I have an issue with Trigger, please help me.

Here I wrote an After Insert Trigger on EmailMessage sObject and this is the output(Image one) and can see ActivityId = Null but when I query the record with the same EmailMessage Id there is a value for ActivityId. What could be the issue?

User-added imageUser-added image

PriyaPriya (Salesforce Developers) 
Hi Sandeep,

This will occur if the user running the anonymous apex does not have the necessary permissions to read the field. Check the field level security and make it either readable or editable for the affected user/profile.
 

Kindly mark it as the best answer if it works for you.

 

Thanks & Regards,

Priya Ranjan