Locking certain records from being modified

LaurentiuPMA
Member Posts: 1
Hello,
I've got a small problem, I need to lock certain Transfer Orders documents from being able to be modified by anyone.
I've added a "Locked" boolean field in 'Transfer Header' table that I want to use to achieve that. I've added some code in the OnModify trigger from the Sales Header table that checks if the Locked field is true, if that's the case I'll throw an error.
My problem is that the trigger isn't run until I move to another record ( in this case the Transfer Lines from the card page ).
Ex. I can modify all fields from the header and then click in the lines part of the page, only then will the OnModify trigger run and I'll receive the error. Upon refreshing, only the last field modified would go back to the initial value.
Is there a nice way of doing this? I can surely add the check for all OnValidate triggers but that would be a bit sad.
A bit of context, I'm displaying a codeunit as a web service, in the codeunit there's a function that sets the Locked field to TRUE or FALSE.
That's the only method of locking/unlocking a record.
I would highly appreciate any help! Sorry if this seems like a dumb problem.
I've got a small problem, I need to lock certain Transfer Orders documents from being able to be modified by anyone.
I've added a "Locked" boolean field in 'Transfer Header' table that I want to use to achieve that. I've added some code in the OnModify trigger from the Sales Header table that checks if the Locked field is true, if that's the case I'll throw an error.
My problem is that the trigger isn't run until I move to another record ( in this case the Transfer Lines from the card page ).
Ex. I can modify all fields from the header and then click in the lines part of the page, only then will the OnModify trigger run and I'll receive the error. Upon refreshing, only the last field modified would go back to the initial value.
Is there a nice way of doing this? I can surely add the check for all OnValidate triggers but that would be a bit sad.
A bit of context, I'm displaying a codeunit as a web service, in the codeunit there's a function that sets the Locked field to TRUE or FALSE.
That's the only method of locking/unlocking a record.
I would highly appreciate any help! Sorry if this seems like a dumb problem.
0
Answers
-
Try putting the locked field on the line level and test on modify line.
Then set the subpage as editable or not based on the field in the header.David Singleton0
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