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
sumithasumitha 

Trigger on Email Message to update Case Object

Hi All,
 
I have created Apex trigger on Email Message Object
Functionality : Updates a Case object status field as "Unread" 
whenever Email Message is inserted or updated with status new. 
 
But,When Email Message with Status "New" under Case Object is created
The Email Message Status changed into Read from New when I just opened the Email Message(without edit).
But the Case Object field remains as "Unread".
 
Expected Result : The Email Message Status changed into Read from New when I just opened the Email Message(without edit), the Case Oject Status field should changed to "Read"
 
Please Suggest a solution.
 
Thanks.
ShirishaShirisha (Salesforce Developers) 
Hi Sumitha,

Greetings!

I have checked with the salesforce internal team and Email Message status can't be handled manually as it is standard and we can not make any changes to this field programatically as well.

Also,can you please confirm,if you have created the workflow rule to change the Case status based on the Email Message Status as suggested below:

https://help.salesforce.com/articleView?id=000330183&type=1&mode=1

If not,please let me know how exactly you are trying to update the Case status field based on the Email Message Status field.

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri