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
Giancarlo AmatiGiancarlo Amati 

case milestone apex doesn't work with email-to-case

Hi All,

I have enabled Email-to-case in my org and wanted to test the code for the case trigger that automatically creates a case milestone under the case, as per this LINK (https://help.salesforce.com/s/articleView?id=sf.entitlements_auto_add.htm&type=5).

When Email-to-case is enabled, any case is created by email, is created in SFDC by e2c, and the trigger is created BEFORE e2c has finished populating the fields on the case record. That makes it impossible to retrieve the entitlement from the account or the contact. 

SFDC Support captured the logs with me and they confirmed that this should not be the expected behavior. 

Has anyone found a different solution? 

Thank you,
]GC
 
AshwiniAshwini (Salesforce Developers) 
Hi @Giancarlo Amati ,
I understand that you have logged a support case. Can you post the solution that worked for you?

Thanks.