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 :
Finance | Project Operations, Human Resources, ...
Unanswered

Function Periodic Approved Timesheet doesn't work

(0) ShareShare
ReportReport
Posted on by 115

Hi everybody

We are running AX 2012 R3.

We are facing a strange way of working with the function 'Post the approved Timesheet".

1. Problem we had but which was solved in July : When we launched the function we got a message : Error executing code. Empty class object does not have the method main. We discover that the  class TSTimesheetAutoPostBatch was not existing in our system

2. To fix this I installed the hot fix 4037381

Now the class is present in the system.

3. But now I have a new problem.

When I click on the function, the input screen opens but when I click on OK nothing occurs. I mean no approved Timesheet are posted.

4. TO understand, I copied the code on the class'run method in a new job

static void Job1(Args _args)
{

TSTimesheetTable timesheet;

while select timesheet
where timesheet.ApprovalStatus == TSAppStatus::Approved
&& timesheet.PostStatus == TSPostStatus::NotTransferred
{
try
{
if (timesheet.validateBudget())
{
timesheet.createCommitmentCostRecords();
TSTimesheetsPost::post(timesheet);
}
}
catch
{
Global::exceptionTextFallThrough();
}
}

}

5.I lauched it an approved Timesheet where psoted.

If you had an idea of why, I woul really appreciate.

Thank's in advance

Christophe

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

    Hi Christophe,

    After point 3 you mentioned: "When I click on the function, the input screen opens but when I click on OK nothing occurs. I mean no approved Timesheet are posted."

    Can you tell with detailed steps what form you opened and what actions you execute here? Probably, you can also add a screenshot for illustration.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Did you choose to run TSTimesheetAutoPostBatch in batch? If so, do you have a batch server running? Do you have any batch server processing the selected batch group at the given time?

    Is CIL updated?

  • Christophe BOURNAC Profile Picture
    115 on at

    Hi

    Thank's for trying helping us

    First Action : Lauching "Post Approved Timesheet" function in Batch

    2021_2D00_12_2D00_07-08_5F00_58_5F00_14_2D00_SVQAXTSE01-_2D00_-Serveur-de-Qualification-_2D00_-Service_5F00_AX_5F00_Install.png

    Second Action : See if the batch was lauched ?

    2021_2D00_12_2D00_07-08_5F00_59_5F00_17_2D00_SVQAXTSE01-_2D00_-Serveur-de-Qualification-_2D00_-Service_5F00_AX_5F00_Install.png

    No Log

    When I launched the job I had writeen with script on the run method of TSTimesheetAutoPostBatch class, the time for posting everything was approximativelly 15 or 20 minutes. 

    Before I did it, I saw that the batch took less than one minute to do the job :-) but nothing was poster

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Please try it without batch processing. If it works, you'll know that the class works correctly and your only problem is with batch processing. If not, you'll know that it's not really about batch processing and you'll need to look at other things.

    Your job is very different - it runs synchronously (not in batch), it runs on the client machine (not on AOS), it runs in X++ runtime (not in CLR), and it runs under local user account (not the AOS service account). Therefore you're comparing very different things and you don't know which of the differences is responsible for the difference.

  • Christophe BOURNAC Profile Picture
    115 on at

    We try with and without Batch Option. Same results

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    I would check if the job is executed in the same company as the one that you're using GUI. Then I would make sure that CIL is updated.

    If it doesn't help, then I would debug the code to see where things fail.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans