AX 2012. Report 'Missing timesheets'. Which class/job is used to send mails?

We use report ‘Project management and accounting->Reports->Hours->Missing timesheets’.

This report has filter ‘Send e-mail’:

6507.tc-1.jpg

This report doesn’t send any mail.

Which other functionality/jobs are used to send mails ?

We want to understand the process. How the emails are sent.

As far as I have been able to tell, there is not actually any code which sends an email.

(Using AX 2012 CU3. It doesn’t appear to be in list of hotfixes for CU4. Not sure about AX 2012 R2)

I have modified AOT\Classes\ProjMissingHourRegDP\insertTmpProjMissingHourReg to include, as shown below.

Note that you will probably have to change “No-reply1@yourcompany.com” to the email address for your AOS service account so emails don’t get rejected by your mail server. It also makes running the missing timesheet report take longer - I estimate 0.5 seconds per email sent, on our system. It also uses quick and dirty sysmailer, so it doesn’t use the email distributor and you can’t see a record of it under the System Administration menus.

Code:

///

/// Gets the required data and inserts it into the temporary table.

///

///

/// Table buffer for the ProjWorkerSetup table

///

public void insertTmpProjMissingHourReg(ProjWorkerSetup _projWorkerSetup)

{

HcmWorker hcmWorker;

// delcare the sysmailer

SysMailer mail;

//end insert

// Variable for the permission class.

InteropPermission perm;

;

perm = new InteropPermission(InteropKind::ComInterop);

perm.assert();

mail = new SysMailer();

//

hcmWorker = HcmWorker::find(_projWorkerSetup.Worker);

tmpProjMissingHourReg.clear();

tmpProjMissingHourReg.PersonnelNumber = hcmWorker.PersonnelNumber;

tmpProjMissingHourReg.Worker = hcmWorker.RecId;

tmpProjMissingHourReg.Name = hcmWorker.name();

tmpProjMissingHourReg.Phone = hcmWorker.phone();

tmpProjMissingHourReg.Hour = (select sum(Qty) from projEmplTrans where projEmplTrans.Worker == _projWorkerSetup.Worker &&

projEmplTrans.WorkerLegalEntity == _projWorkerSetup.WorkerLegalEntity &&

projEmplTrans.TransDate >= periodFrom &&

projEmplTrans.TransDate <= ProjPeriodLine::find(periodId,periodFrom).PeriodTo).Qty;

tmpProjMissingHourReg.PeriodId = _projWorkerSetup.PeriodId;

tmpProjMissingHourReg.PeriodFrom = periodFrom;

tmpProjMissingHourReg.PeriodTo = periodTo;

// insert sysmailer quicksend here to actually send an email!

if (sendMail && (hcmworker.email() != “”) == true) {

mail.quickSend(“No-reply1@yourcompany.com”, hcmWorker.email(), strFmt(“Missing timesheet for %1”, tmpProjMissingHourReg.Name),

//strFmt(“Worker Email: %1 \r”,hcmWorker.email())

strFmt(“Please complete your timesheet for the period %1 to %2 - thank you!”, tmpProjMissingHourReg.periodFrom, tmpProjMissingHourReg.periodTo)

);

}

// end of insert

tmpProjMissingHourReg.EmailSended = (hcmWorker.email() && tmpProjMissingHourReg.Hour == 0 && sendMail) ? true : false;

tmpProjMissingHourReg.insert();

}