How to tell Service Report PDF Merge is complete on server?
Is there any way to tell when the PDF is done merging on the server?
I built an AFTER trigger on attachment for purpose of emailing customer as soon as the Service Report PDF hits the server - but it kept emailing as corrupt PDF attachment. It works if triggered after the insert manually, even by a few seconds. I am guessing that this because the merge is not complete at the time of actual insert of the PDF attachment type?
Have not figured out a way to have the trigger "wait" - is there some actionable attribute that i can use to know when the merge is complete other than INSERT? Like a "MergeComplete" check somehow?
currently using scheduled apex to kick out the service report emails every hour, but always gets emailed as MY email - not the Technicians :/ best i can do is CC them
**currently using iPap implementation, so Service Reports come in sporadically with regards to when WO actually goes to CLOSED status - could be minutes later or days later depending on Technician cellular availability
Re: How to tell Service Report PDF Merge is complete on server?
Did you tried future annotation?
Create a After Insert Trigger on the Attachment and then create a class which has future method to send the email as an attachment to the corresponding users. Call that future method from the trigger which you have created.
Future methods will be executed once all the resources are available. So, it might be worth to try this.