WorKDate Change Using Codeunit

Hi all,

I want to change workdate in RTC in navision 2016 . when i run a codeunit i put a code for set the workdate like :

onRun()

workdate := 010116D

and in RTC workdate is Different like this

pastedimage1498736763208v1.png

so now, when i will run CodeUnit then automatically workdate is change according to my date(010116D) but it’s not changed, why?

In nav 2009 ,this things is possible.

Please suggest me how i can change workdate on RTC using Codeunit…

can u be clear about your statement
so now, when i will run CodeUnit then automatically workdate is change according to my date(010116D) but it’s not changed, why?

Hi Akkrahul if you need to change work date in RTC then please choose the dropdown in the top left corner of RTC and select “Set Work Date”. You will be able to modify the work date for your desired date choosing this option.

If you need to change through code then refer CompanyOpen() of Codeunit 1 Application Management. Because workdate is updated automatically when ever you open RTC based on this function.

So if you need a different workdate then please go through the code of LogInStart() function which is written in CompanyOpen() function.

I don’t recommend to modify this existing base codeunit. But surely you’ll come to know how workdate is updated in NAV 2016 by having a look at LogInStart() function.

Hi Sir,
i have try this things in Codeunit-1 . it’s worked , i have changed workdate in RTC using Codeunit object. Thank You.

Hi Sir ,

now my question is Different , When i open any page from navigation pane on RTC , then i want to change workdate automatically in RTC .

this things is possible in NAV-2009 in classic automatically . but in NAV -2016 not done. please give me any suggestion for this …

I guess my previous reply only has the answer for your question. You should change work date in drop down at top left corner of RTC or you need to have a look at LogInStart Function and modify it accordingly if it has to happen automatically.