We need to block attempts of changing working date for some users.
Is it possible to allow/deny changing Work Date (Tools | Work Date) via standard permissions functionality?
No. That's not possible.
You could use the fields "Allow Posting From" and "Allow Posting To" in the User Setup table to control the dates users can use.
its not possible with permissions. But when changing the workdate, the CU1, i belive Function MakeDate (or so), will called. So here you can store your code.
I didn't try that but you could create a single instance codeunit which is called from CU1 and do every 10 Seconds
IF WORKDATE <> TODAY THEN
WORKDATE := TODAY;
You could make it more comfortable and check if the user is allowed to change the workdate.
Therefore add a field to table User Setup (e. g. "Allow change Workdate")
Then the code in your single instance codeunit looks like this:
IF UserSetup.Code <> USERID THEN // This line is for performance
IF NOT UserSetup.GET(USERID) THEN
UserSetup.INIT;
IF (NOT UserSetup."Allow change Workdate") AND
(WORKDATE <> TODAY)
THEN
WORKDATE := TODAY;
when you not will touch the CU 1, you must create your own CU. But to work with this CU, it must called from CU1.
Or, your Codeunit is Singlieinstance and loaded in Function LoginStart and with Timer it go throw every x seconds. but this way #-o
So easiest and best way: modify cu1. You can make here your own function which is called from the function i sayed. In your function you handle the user permissions.
Comments
You could use the fields "Allow Posting From" and "Allow Posting To" in the User Setup table to control the dates users can use.
Tino Ruijs
Microsoft Dynamics NAV specialist
That's not useful for purposes we'd like to limit date change.
D-oh! Coding, coding, coding...
And it's also called from everywhere from the date fields, when you chane date, for example...
Also, I'm trying to keep CU1 unchanged.
So, I should make mods in a range of interesed objects...
thanks all!
Posting date = work date?
posting date = today?
or a range of a day either way or a range for a month?
http://www.BiloBeauty.com
http://www.autismspeaks.org
Therefore add a field to table User Setup (e. g. "Allow change Workdate")
Then the code in your single instance codeunit looks like this:
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
Actually, posting date <> workdate...
Hm... Looks useful.
Will also try to allow every System except 0 in Permissions.
Just modify CU1, that is the best way.
Or, your Codeunit is Singlieinstance and loaded in Function LoginStart and with Timer it go throw every x seconds. but this way #-o
So easiest and best way: modify cu1. You can make here your own function which is called from the function i sayed. In your function you handle the user permissions.