a Job queue run but got old data which updated earlier

robintptsairobintptsai Member Posts: 9
Any suggestion or guidance will be welcome for my weird question, thanks in advance.

There is a NAS service to run NAV job queues (by service account: domain\navservice1) on a NAV5.0 SP1 environment. The job runs well always.

Most of job queue entries created by domain\navservice1(User ID = domain\navservice1), except one job (Codeunit 80008, User Id = domain\navservice2)

The weird thing is: a user changed GL period from [7/1~7/31] to [8/1~8/31] in the morning already on 8/1, a job queue (to post sales orders, Codeunit 80008, run at 21:30 daily) run at night (21:30, 8/1) still got old GL period (7/1~7/31) and cause posting failed (posting period not allow)...

Is [Job Queue].[User ID] matters?

I've also checked the code and I think the local variable (LocalGLSetup) will be refreshed each time, however, the logs shows that LocalGLSetup variable got old value instead...

Keep checking, any guidance will be welcome, thanks again.


Here is my code (C80008):

OnRun(VAR Rec : Record "Job Queue Entry")
f_PostSOMain();

f_PostSOMain()
SRSetup.GET;

Msg := 'C80008 SO Auto Posting BEGIN ' + FORMAT(CURRENTDATETIME);
Log.f_Info('AUTO POST', 'C80008', Msg);

If NOT localGLSetup.GET Then ERROR('GL Setup not found');
Msg := 'GL Period: ' + FORMAT(localGLSetup."Allow Posting From") + '~' + FORMAT(localGLSetup."Allow Posting To");
Log.f_Info('AUTO POST', 'C80008', tMsg);

...

Comments

  • KishormKishorm Member Posts: 921
    Try adding a SELECTLATESTVERSION at the start of the code this should clear he client cache and get the most recent data.
  • robintptsairobintptsai Member Posts: 9
    Thanks for suggestion.

    I think SELECTLATESTVERSION is good way but it requires extra db permission which is not allowed under current IT policy, I will try to prove this solution did working and convince decision makers to adopt my proposal.

    Many thanks.
  • KishormKishorm Member Posts: 921
    Are you sure it requires extra db permissions? I haven't read anything on this before or had any issues when using it. I have also checked the help file and MSDN and neither mentions that extra db permissions are required.
  • robintptsairobintptsai Member Posts: 9
    Oh, it seems I had wrong concept on SELECTLATESTVERSION, let me try to figure it out.

    Many thanks for such good comments.
Sign In or Register to comment.