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.....
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.
Answers
Not sure if it would be better thought....
My Dynamics NAV Blog: olofsimren.com
My Google Plus Profile
Naviona - My Dynamics NAV Partner
[* except system admin/Super user]
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.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03