Hi,
I recently setup our Invoices & Statements to be emailed out directly from Dynamics.
I've just had a request come back to make the emails stay in the queue for an hour before they get sent out.
This is to give the users time to realize they made a mistake and locate the item in the queue and delete it before it goes out to the customer.
Does anyone know if this is possible? The email batch processing job doesn't have any sort of options around making sure the created time is at least 1 hour ago before running it (that I found anyway) I'm not even sure where I can go in X++ to control the behavior of the email batch processing job.
The easiest option is for the email batch to set the emails to go out at 6pm (1 hour after close of business), but that's not quite what was intended.
<insert lengthy pause as I just went and checked something and answered the question for myself>
Funny how simply the act of writing out your question can lead you to the solution. I was going to close this but then thought others might find it useful.
I found the class I needed to edit was called sysEmailDistributor.
Inside the run method there was a while select that ran over all of the emails to be sent.
I changed the where clause from ...(outgoingEmailTable.Status == SysEmailStatus::Unsent)...
to ...(outgoingEmailTable.Status == SysEmailStatus::Unsent) &&
(outgoingEmailTable.createdDateTime <= DateTimeUtil::addHours(DateTimeUtil::utcNow(),-1)) ...
Quick fix I know. I'll extend it by creating the -1 as a parameter and have it able to be set inside Dynamics rather than being just a magic number buried inside the code. But if anyone has a similar problem...
Thanks,
Adam