You need to sign in to do that
Don't have an account?
Rebecca Pitts
Send email with service report pdf when a new service report is created
Hey do you know if it’s possible to send email with attachment when a new service report has been created through apex trigger? In field service when my techs create a service report we have to go in and manually email the pdf report each time, but there has to be a way to do this automatically. Could you help?
CodenameSnugs
I'm a bit late to the party here, but yes it's possible. We have an 'Email Service Report' checkbox on our Service Appointments that the trigger uses to determine whether or not to send the email. The trigger fires after the Service Report is created:
Alison Richards
CodeNameSnugs what is the test class you used?
CodenameSnugs
Hi Alison, the test class is below. Build your data for the class (account, contact, case, work order and service appointment, with the email trigger field checked). The key part starts at the '// create service report' line as you need to create a 'fake' document with the service report.
Alison Richards
Thank you so much especially for the fast reply Snugs, much appreciated! I am not getting any probelms with the trigger or the test class, just don't seem to be sending the report when email service report checkbox is true on the service appointment object, contact_email contains an email and service report is generated capturing client's signature. Not sure if it will make it easier to see it. If yes, can you email me at alison@etcsimplify.com. Maybe we can do a gotomeeting or teamviewer, if yes I can set up?
Lukas Ruess
The code and the testclasses up there are super helpfull thank you. We are currently struggling that this E-Mail is really being sent out. We would like that this mail is being sent out by the Org Wide E-Mail Adress. Do you know how we could make the code look like so that this is being sent out by this e-mail adress? Thank you in advance