cancel
Showing results for 
Search instead for 
Did you mean: 

How to tell Service Report PDF Merge is complete on server?

Highlighted
Roast Chef
Roast Chef

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

0 Likes
Reply
Fry Chef
Fry Chef

Re: How to tell Service Report PDF Merge is complete on server?

Hi Alex,

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.

Regards

Mohan

Roast Chef
Roast Chef

Re: How to tell Service Report PDF Merge is complete on server?

was considering trying it - just not sure if the delay will be gauranteed to be long

(also i have never written a @future method before, more worried about trying to get code coverage )

Thought about doing a check on file size but not sure if that will work either

Appreciate the response!  If i get the @future method to work ill post my results

0 Likes
Reply