Particular Column Value modification allowance

navuser1
Member Posts: 1,334
Hi,
I am working on NAV 2013 R2 Database.
I want that No one can change the Document (record) if this Document (record) carries a TRUE value in a Boolean field. Only those can change who has proper rights in USER SETUP TABLE (ID 91).
But at the same time I have to give a provision to the end user to change the Posting in same Record if required, but can not change other field level records in any circumstances.
To achieve this I have added the following code under the Table/Page Triggers.....
This is working absolutely fine. Is there any other way I can manage the same ?
Kindly inform.
I am working on NAV 2013 R2 Database.
I want that No one can change the Document (record) if this Document (record) carries a TRUE value in a Boolean field. Only those can change who has proper rights in USER SETUP TABLE (ID 91).
But at the same time I have to give a provision to the end user to change the Posting in same Record if required, but can not change other field level records in any circumstances.
To achieve this I have added the following code under the Table/Page Triggers.....
TABLE---- OnModify() IF Approved AND (xRec."Posting Date" = Rec."Posting Date") THEN BEGIN UserSetup.GET(USERID); UserSetup.TESTFIELD(Authorized,TRUE); END;
PAGE---- Posting Date - OnValidate() CurrPage.UPDATE(TRUE);
This is working absolutely fine. Is there any other way I can manage the same ?
Kindly inform.
Now or Never
0
Answers
-
You could potentially add a date variable to the page and have validation code on that one to update the record without running the OnModify trigger.
Not sure if it would be better thought....Olof Simren - Microsoft Dynamics NAV Expert | Founder of Naviona
My Dynamics NAV Blog: olofsimren.com
My Google Plus Profile
Naviona - My Dynamics NAV Partner0 -
I have to execute the table OnModify trigger because I don't want to allow any end users* to modify/change the other field's value in spite of Posting Date field.
[* except system admin/Super user]Now or Never0 -
It seems to be quite easy to workaround - change some fields, then change
the Posting Date to +1 day, and then change the posting date back.
Just a thought.
If you're looking for other places where to put your code you don't have many options in NAV2013R2. You'd probably need to stick to modification of OnModify trigger in the table, but I'd say create a new function in custom codeunit and in OnModify trigger on the table just call that function, or even better put your checking code in the OnRun trigger in your codeunit and call CODEUNIT.RUN(yourcodeunitid, rec) in OnModify trigger.
This is to minimize standard table modifications.
SlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030
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