NAV 2016 User permission for changing the WORKDATE

wittgenstein
Member Posts: 17
Hi,
at first:
I'm new in the forum, so I apologize for eventually posting my topic in the wrong forum section. Also I apologize for any grammar mistakes as I am not a native speaker.
I'd like to only let permitted Users change the work date. I found several topics in the forum about this but unfortunately there was no solutionn for me.
According to my supervisor I must not use any timer-based solutions.
What are my options? There doesn't seem to be any specific trigger being executed after changing the work date...
I tried out several triggers in Codeunit 1 (OnDatabaseModify/OnDatabaseDelete/... , MakeDateText/MakeTimeText/...) but it didn't have any effect.
This is my code I want to run (it's in a separate Codeunit):
Thanks in advance
Wittgenstein
at first:
I'm new in the forum, so I apologize for eventually posting my topic in the wrong forum section. Also I apologize for any grammar mistakes as I am not a native speaker.
I'd like to only let permitted Users change the work date. I found several topics in the forum about this but unfortunately there was no solutionn for me.
According to my supervisor I must not use any timer-based solutions.
What are my options? There doesn't seem to be any specific trigger being executed after changing the work date...
I tried out several triggers in Codeunit 1 (OnDatabaseModify/OnDatabaseDelete/... , MakeDateText/MakeTimeText/...) but it didn't have any effect.
This is my code I want to run (it's in a separate Codeunit):
WorkDatePermissionCheck() IF NOT UserHasPermission THEN BEGIN IF WORKDATE <> TODAY THEN BEGIN WORKDATE := TODAY; MESSAGE(Error001,USERID); // ERROR(Error001,USERID); END; END; UserHasPermission() : Boolean IF NOT UserSetup.GET(USERID) THEN EXIT(FALSE); EXIT(UserSetup."Allow Changing Workdate");
Thanks in advance
Wittgenstein
0
Best Answer
-
Hi Wittgenstein,
at first: your English is fine!
Because you don't mention a reason why the WORKDATE may not be changed I assume it just is a 'security' measure requested by someone who doesn't understand NAV.
The only way (I know of) to do something remotely close to this is to :
a- find every place in NAV where WORKDATE is used and call your function there...
b- dynamically change user allowed posting range every day/login.
But you understand that this is not the way any erp system should be setup.
\\The truth exists in seven versions.5
Answers
-
Hi Wittgenstein,
at first: your English is fine!
Because you don't mention a reason why the WORKDATE may not be changed I assume it just is a 'security' measure requested by someone who doesn't understand NAV.
The only way (I know of) to do something remotely close to this is to :
a- find every place in NAV where WORKDATE is used and call your function there...
b- dynamically change user allowed posting range every day/login.
But you understand that this is not the way any erp system should be setup.
\\The truth exists in seven versions.5 -
Hey,
thanks for your reply.Because you don't mention a reason why the WORKDATE may not be changed I assume it just is a 'security' measure requested by someone who doesn't understand NAV.
a- This would probably take tons of changes in standard objects. I don't know if our customer would be happy with that. Nevertheless I will give it a try. OMA should help there.
b- So you mean to modify the "Allow Posting From" and the "Allow Posting To" Fields in User Setup on startup? Hm. That wouldn't even require to touch standard objects in NAV 2016...
Anyway. I have to clarify if our customer needs the work date user permission only for posting routines or also for other routines accessing the work date.
Maybe I can convince our customer to just sensitize their Users to not touching the work date.
However thanks for your answer. Let me know if you have more ideas. I'll let you know if I have found a solution for myself
Edit
My feedback:
The only reliable option to suppress workdate change directly was a solution with a timer. It's not very elegant IMHO but it works.
Anyways I decided to go with Peter+is1's suggestion 'b'. Thanks again for your help, Peter!
As a side information: The workdate change is controlled in the executables of Dynamics NAV. So there is no way to manipulate and/or customioze this option directly.0 -
Hey,
I have another idea for a solution but I don't know if it would work.
Can you somehow have access to the user32.dll or any other WinDlls (WinAPI)? Maybe with an Automation variable or a DotNet variable? Or do I have to write my own Dll in C# for accessing these functions?
With FindWindow/FindWindowEx you can maybe get the window handle and manipulate it.
As I said, I don't know if it works or if it is a silly idea but imo it's worth a try...0 -
I have some thoughts about that but those are way outside the scope of this forum...\\The truth exists in seven versions.0
-
Do you mind sharing your thoughts with me
? I'm really interested. If you don't want to post it publically in this topic you can also send me a PM.
I already managed to Hide and Disable the OK-Button in an external process. But I don't know how to use WinAPI functions out of NAV. Is this possible or do I have to create a "third-party" Dll?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions