Hi DinB, that field can’t do it. Last Email Sent Time is a FlowField, it takes the newest Email Related Record linked to the sales header, so any email connected to the order moves it, and as far as I see there’s no document type in that table to filter on.
What I’d do is your own field on Sales Header, say Order Conf. Email Sent as DateTime, and fill it from the Document-Mailing codeunit. It has an event OnAfterEmailSentSuccesfully (spelled like that) which gives you PostedDocNo and ReportUsage. For the order confirmation ReportUsage is S.Order from the Report Selection Usage enum and PostedDocNo should be the order number, so you Get the header and stamp CurrentDateTime.
One catch, with the email editor that event fires when the user presses Send I think, the mail then sits in the outbox, so it means sent by the user, not delivered.
Glad to help - follow up if anything is unclear.
► If this solved it, marking it verified helps others too.
Regards,
Grigorios Mavrogeorgis
Business Central Consultant & AL Developer
Work: Gmsoft Limited
Blog: insidebusinesscentral
LinkedIn: linkedin.com/in/gregorymavrogeorgis