You need to sign in to do that
Don't have an account?

Test Email-to-Case with mass emails and EMailMessage trigger
We are working on an org where cases are generated via Email-to-Case and a trigger on EmailMessage is carrying out some processes. A batch job then in a 5 minute rhythm works on these generated cases and does some further processing.
Here my questions:
Thanks in advance for your responses and time
Here my questions:
- How can we simulate that 100-1000 emails are sent to this Email-to-Case email address? Via Apex Script in the Anonymous Code Block?
- The problem that we face with the apex script is that when we try sending 10 emails via Messaging.SingleEmailMessage - everything works fine the EmailMessage Objects have a parentId reference to the case which is also visible in the EmailMessage trigger. But when we try sending about 100 emails via Messaging.Email the EmailMessage object has also the parentId case reference but the parentId is null in the trigger
Thanks in advance for your responses and time
May I suggest you simply mock 100 EmailMessages as if they came from Email2Case and insert in a test method
Note: by the time the real Email2Case builds these objects, they will have a parentID so you'll need to mock Cases aforehand
Thanks,
Nagendra