Security to push button in Vendor Card

souravb
Member Posts: 135
Hi,
I have created a menu button in vendor card called 'Calculate Score". I want only user having id 'SB' will be able to calculate the score when the button is pushed. For other users the system will throw authorization error. I have written a code like this:
IF CONFIRM('Do You want to calculate score?',TRUE) THEN BEGIN
GVUserSetup.GET(GVUserSetup."User ID");
IF GVUserSetup.FIND('-') THEN
IF GVUserSetup."User ID"<> 'SB' THEN BEGIN
ERROR('You are not authorized to calculate vendor score');
EXIT;
END;
when i run the card and push the button for all users the error is coming as such "User Setup User ID " does not not exist"
How do i solve it. Plz help.
0
Comments
-
Keep it simple
First line
IF USERID <> 'SB' THEN
ERROR('Errormessage');
This makes sure that if the user is not SB an error occurs
Second line. (Navision will have stopped if the error kicked in)
IF CONFIRM('Do You want to calculate score?',TRUE) THEN
Callcalculation;Don't just take my word for it, test it yourself0 -
I completely agree that it should be kept as simple as possible. However I always question harcoding any checks like this. Could you add a field to the User Setup table that determines whether or not they're allowed to run this calculation. This will ensure that the client can manage this without having to push this back to a developer.0
-
It depends on what the requirement is. If you want more than one person to be able to run that calculation, then you could add a checkbox to the user setup table. If there's only one person in the entire company that whouls be able to do this, then you'd add a field to a functional setup table. So if this is some sort of sales calculation, you'd add a 'Calculation User ID' field to the Sales & Receivables Setup table. Then you'd program a check into the calculation to either check if the user setup record has the checkmark, or if the user running the process has the same user ID as in the sales setup.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