How to set Workdate to Today in Cronus Demo Environments
In demo environments (Cronus) not licensed Demo Company the workdate is set automatically by reading from the recorded ledger entries. This can be annoying if I want to use these environments for testing \ models or prototypes.
Even in a non-activated PRODUCTION environments, it is the same thing. The workdate can always be changed manually but if I forget to do it, I could have some wrong writings.
The date updated to today is useful to have it before opening a form and creating registrations. One possibility is to intercept the opening of the pages and to change the workdate upon opening.
Business Central runs these events during the opening of the pages as it has to update the notification bar, we hook them to set the workdate; in this way we do not connect to the role center, headlines etc.
Subscribing to this simple event “System Action Triggers”\GetNotificationStatus we can force the update of the Workdate
Codeunit 70000 “Events change Workdate”
EventSubscriberInstance = StaticAutomatic;
[EventSubscriber(ObjectType::Codeunit, Codeunit::”System Action Triggers”, ‘GetNotificationStatus’, ”, true, true)]
procedure GetNotificationStatus(NotificationId: Guid;
var IsEnabled: Boolean)begin
Just open a page and the system changes the workdate to Today
Example: Currencies page
WORKDATE = TODAY