Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Function Periodic Approved Timesheet doesn't work

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

  • Martin Dráb Profile Picture
    Martin Dráb 230,235 Most Valuable Professional on at
    RE: Function Periodic Approved Timesheet doesn't work

    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.

  • Christophe BOURNAC Profile Picture
    Christophe BOURNAC 115 on at
    RE: Function Periodic Approved Timesheet doesn't work

    We try with and without Batch Option. Same results

  • Martin Dráb Profile Picture
    Martin Dráb 230,235 Most Valuable Professional on at
    RE: Function Periodic Approved Timesheet doesn't work

    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
    Christophe BOURNAC 115 on at
    RE: Function Periodic Approved Timesheet doesn't work

    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
    Martin Dráb 230,235 Most Valuable Professional on at
    RE: Function Periodic Approved Timesheet doesn't work

    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?

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: Function Periodic Approved Timesheet doesn't work

    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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans