C/AL code for specific user

guganvarman_21
Member Posts: 16
I need only specific user to update the sales price.In the user setup table i have created a boolean .only the person with that boolean tick can update the sales price.how to write c/al code for this?
thanks
gugan
thanks
gugan
0
Answers
-
please answer its emergency
-2 -
In the beginning of the OnValidate trigger of the field, get the User Setup Record for the current user
UserSetup.GET(USERID)
Then check if your new boolean field is activated, if it's not throw an error.IF NOT UserSetup."Boolean Field" THEN ERROR('Your text as textconstant here')
Remember to create a local variable of type Record and Subtype 91 (User Setup Table) for this purpose.2 -
Thanks Klappspaten.
There are 4 users in the user set up and i need only particular users to update the price.In that case how can i give privilege to that users alone0 -
This way you did it.
The code I provided does the following:
1. The OnValidate trigger of the price field is invoked
2. Get the User Setup Record for the user which invoked the trigger
3. Check if the user has the priviledge to change the price
4. The user has no priviledge/flag? Throw an error.
If you need to give other users the priviledge to modify the price, or want to remove the priviledge for a user, activate(deactivate your new boolean field at User Setup for this user.1 -
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
This discussion has been closed.
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