Prevent user triggered changes via Table Subscriber

jordi79
Member Posts: 280
Hi,
I am trying to prevent user triggered changes to a Vendor table. Changes done indirectly is allowed e.g. Changes done via C/AL MODIFY, INSERT or DELETE statements are allowed.
I am looking at the triggers for the Vendor table, but I cannot find any suitable events. The most suitable I can find is to use the OnAfterModifyEvent and check the RunTrigger value. But, if a MODIFY(TRUE) statement is called, this will trigger this event too.
I am trying to prevent user triggered changes to a Vendor table. Changes done indirectly is allowed e.g. Changes done via C/AL MODIFY, INSERT or DELETE statements are allowed.
I am looking at the triggers for the Vendor table, but I cannot find any suitable events. The most suitable I can find is to use the OnAfterModifyEvent and check the RunTrigger value. But, if a MODIFY(TRUE) statement is called, this will trigger this event too.
0
Answers
-
Very special request...
As you said, you can just use the onbeforemodify, onbeforeinsert, and onbeforedelete triggers and indeed check the RunTrigger value.
When C/AL runs a MODIFY(TRUE) statement that will also be true.
You could work around it by adding an additional Boolean field in the table, AllowCALChange.
Whenever your subscriber is triggered, you could check both values.
Before your MODIFY statement, you should simply change the AllowCALChange value to true.if (not Rec.AllowCALChange) then if (RunTrigger) then exit; Rec.AllowCALChange := false; ...
I don't understand why you would want to restrict changes done through the regular UI, but this workaround should get you your desired result.0 -
You should make the page(s) Editable=FALSE instead.
You could also monitor all field's OnValidate trigger (Table) and check CurrFieldNo there.0 -
I used CurrentClientType = BACKGROUND instead. The purpose of the customisation was to integrate NAV vendors so that they are managed externally. And since the integration was done via JobQueue, this solution worked for me.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