Hey everyone, running into something that I suspect is a known limitation but wanted to check if anyone has found a proper workaround. I’m on v15
I have a custom Incident doctype. When a new incident is created, an email notification fires with an attached PDF of the print format. The problem is that the PDF comes out with no images. If I open the same print format manually from the saved document, everything looks fine, images included. But the notification email’s attached PDF is always blank where the images should be.
After digging into it, I think I understand why this happens. Attachments in Frappe are linked to a document only after it’s been saved and a name (the unique ID) has been generated. The issue is that by the time that save happens, the notification has already fired and the PDF is already being generated, so there’s nothing for it to pull the images from. Even if I set up a child table for attachments, they still depend on the document being fully saved before they’re accessible, which puts them outside the window of when the notification runs.
So it feels like this is a design-level constraint, the notification email’s print format PDF fundamentally can’t include images that are uploaded as attachments because of the order in which things happen under the hood.
The tricky part for me is that this is an Incident report, and the images are kind of the whole point. Responders attach photos of the incident and those need to be in the emailed PDF so whoever receives the notification actually sees what happened.
Has anyone worked around this? I’m thinking maybe storing images as inline base64 in a text field rather than as file attachments, or maybe triggering the email through a server script after a slight delay, but both feel a bit hacky. Would love to hear if there’s a cleaner approach or if this is something that’s been solved before.