web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Faulty missing timesheet notification email in AX 2012?

(0) ShareShare
ReportReport
Posted on by

Hi,

My company are using timesheets in module Project & accounting in AX. Every thing looks pretty well except that the missing timesheet notification email works incorrectly. Several timesheet users that have already submitted their timesheets on time or even, early than a deadline 02, even 03 days, but they still received a "missing timesheet" like below:

From: AX Admin
Sent: Monday, November 16, 2015 12:12 PM
To: Edward Jd
Subject: Missing timesheet for this period

 

 Hello,

 

This is reminder that as of today, you have not submitted your project timesheets for last week.

Please make every effort to complete this at your earliest.

Regards,

 

AX ADMIN

Please help!

Thanks

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,896 Super User 2025 Season 2 on at

    Hi Thai,

    Please check if therr are some periods where the time was not entered. The mail is setup with the text last week, but it can also be related to another week. At another customer we have setup to include the period in the mail.

    You can print the missing timesheets report to find out which period is not completed.

    In the past there was also an issue where it was not correctly recognized which periods needs to be completed based on the employment dates. Which version of AX 2012  are you running?

  • Community Member Profile Picture
    on at

    Hi Andre,

    Below is the version that I'm using now. In fact, not all time-sheet users get the 'missing notification email' so I guess your saying '... some periods where the time was not entered' makes sense. My friend who does worker update periods usually runs the update from '09/28/2015' for any new time sheet users regardless when they start working (in Sep, Oct, Nov). So there are several time-sheet users having 'unwanted weekly periods that they never have working hours'. I just wonder if these periods can be removed or deleted from AX for a specific time sheet user or not.

    Thanks

    Thai

    1055.AXVersion.jpg

  • André Arnaud de Calavon Profile Picture
    300,896 Super User 2025 Season 2 on at

    Hi Thai,

    You can check the periods for these users. Or delete some records in the worker periods table or manage it using the employment start date.

    You can use variables in your email messages like:

    %PeriodFrom%

    %PeriodTo%

    %name%

    %TimesheetNumber%

    These will be replaced during creation of the email messages.

  • Community Member Profile Picture
    on at

    Hi Andre,

    Thanks for your advice, Andre: it's a very good idea to me to make not only notification message clearer, but also timesheet users not confused. Therefore I changed the notification message using variables as mentioned following your guide.

    Beside that, I also tried to delete a few weekly periods (that I don't have any hours) for my timesheets in my test environment. Then I run the missing timesheet report: it still show that I is one of employees who miss a timesheet.

    Thanks

    Thai

  • André Arnaud de Calavon Profile Picture
    300,896 Super User 2025 Season 2 on at

    Hi Thai,

    Can you explain what you mean with " I also tried to delete a few weekly periods (that I don't have any hours) for my timesheets in my test environment."?

    Did you delete periods in general or worker periods?

    Have you also tried to change employment dates of this worker in HCM?

  • Community Member Profile Picture
    on at

    Hi Andre,

    I'm sorry to make you confused. For some reason, my coworker usually does 'Update worker periods' from 09/28/2015. Therefore new comers start working in Oct, Nov or Dec 2015 also have weekly periods starting from 09/28/2015 & so they don't have any hours in these periods (before their employment start dates). In testing environment, I've tried to delete these periods for my profiles, but the missing timesheet report still shows me as who have missing timesheets in those periods above.

    I haven't tried to change employment start date because these dates were input correctly in our AX.

    Thanks

    Thai

  • André Arnaud de Calavon Profile Picture
    300,896 Super User 2025 Season 2 on at

    Hi,

    would it be possible to verify the contents of the run method from the class ProjMissingHourRegEmail?

    I would like to know if this method has some statements where the hcmemploymenttable is considered.

    what start date of the employment is used for your workers?

  • Community Member Profile Picture
    on at

    Hi Andre,

    One emp. has her employment start date: 12/03/2015, but she has worker periods since 09/28/2015.

    As your thinking, table hcmemployment is used.

    Below is the content of run in class :

    /// <summary>

    /// Contains the code that does the actual job of the class.

    /// </summary>

    public void run()

    {

       HcmWorker                     hcmWorker, hcmManager;

       HcmPositionRecId              hcmPositionId;

       HcmWorkerRecId                hcmManagerId;

       HcmEmployment                 hcmEmployment;

       ProjParameters                projParameters;

       ProjPeriodLine                projPeriodLine;

       ProjWorkerSetup               projWorkerSetup;

       TSTimesheetTable              tsTimesheetTable;

       str                           userName, managerName;

       SysEmailId                    sysEmailId;

       SysUserInfo                   sysUserInfo;

       Map                           mappings = new Map(Types::String,Types::String);

       int                           emailsSent =0, missingEmailIds =0;

       // Method to convert the DateTime to Date applying the timezone offset

       date convertToDate(utcDateTime _dateTime)

       {

           return  DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(_dateTime, DateTimeUtil::getUserPreferredTimeZone()));

       }

       this.initQuery();

       // Get the email template Id from the projParameters table

       select firstOnly MissingTimesheetsEmailId from projParameters;

       sysEmailId = projParameters.MissingTimesheetsEmailId;

       if (!sysEmailId)

       {

           // If the email template Id is not found, throw an error.

           throw error("@SYS4003506");

       }

       startLengthyOperation();

       ttsbegin;

       while (queryRun.next())

       {

           projWorkerSetup         = queryRun.get(tableNum(ProjWorkerSetup));

           projPeriodLine          = queryRun.get(tableNum(ProjPeriodLine));

           tsTimesheetTable        = queryRun.get(tableNum(TSTimesheetTable));

           hcmEmployment           = queryRun.get(tableNum(HcmEmployment));

           // As we have relaxed the ranges by 2 days on both sides in the query earlier, we perform a strict check here.

           if(((convertToDate(hcmEmployment.ValidTo) <= periodToDate) && (convertToDate(hcmEmployment.ValidTo) >= periodFromDate)) ||

              ((convertToDate(hcmEmployment.ValidFrom) <= periodToDate) && (convertToDate(hcmEmployment.ValidFrom) >= periodFromDate)) ||

              ((convertToDate(hcmEmployment.ValidFrom) <= periodFromDate) && (convertToDate(hcmEmployment.ValidTo) >= periodToDate)))

           {

               // Find the worker from HcmWorker table to get the data

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

               hcmPositionId = HcmWorker::getPrimaryPosition(projWorkerSetup.Worker);

               hcmManagerId = HcmPosition::getReportsToWorker(hcmPositionId);

               hcmManager   = HcmWorker::find(hcmManagerId);

               managerName  = hcmManager.name();

               // If the timesheet's approval status is Create(Draft), All(Missing) or Returned then send email

               if (hcmWorker.email()

                   && (tsTimesheetTable.ApprovalStatus == TSAppStatus::All

                   || tsTimesheetTable.ApprovalStatus == TSAppStatus::Create

                   || tsTimesheetTable.ApprovalStatus == TSAppStatus::Returned) )

               {

                   sysUserInfo = sysUserInfo::find(curuserid());

                   userName = sysUserInfo.Email;

                   mappings.insert('name', hcmWorker.name());

                   mappings.insert('telephone', hcmWorker.phone());

                   mappings.insert('hours',strfmt("%1", tsTimesheetTable.totalHours()));

                   mappings.insert('periodCode', projWorkerSetup.PeriodId);

                   mappings.insert('timesheetNumber', tsTimesheetTable.TimesheetNbr);

                   // If 'All' is the timesheet status, replace it with 'No timesheet'

                   if(tsTimesheetTable.ApprovalStatus == TSAppStatus::All)

                   {

                       mappings.insert('status', "@SYS4003505");

                   }

                   else

                   {

                       mappings.insert('status', enum2str(tsTimesheetTable.ApprovalStatus));

                   }

                   mappings.insert('periodTo', date2StrUsr(projPeriodLine.PeriodTo, DateFlags::FormatAll));

                   mappings.insert('periodFrom',date2StrUsr(projPeriodLine.PeriodFrom, DateFlags::FormatAll));

                   mappings.insert('manager', managerName);

                   // Send email

                   SysEmailTable::sendMail(sysEmailId, SysEmailTable::find(sysEmailId).DefaultLanguage, hcmWorker.email(), mappings, '', '', true, userName, true);

                   emailsSent++;

               }

               else if (!hcmWorker.email())

               {

                   // If the worker does not have the email configured, increment the missing email Ids counter.

                   missingEmailIds++;

               }

           }

       }

       info(strFmt("@SYS4003503", emailsSent, missingEmailIds));

       ttscommit;

       endLengthyOperation();

    }

    Thanks

    Thai

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans