Field-level security does not exist out-of-the-box in NAV and is not easy to implement. In fact, real field-level security is impossible to implement. This recipe will show you an example of how to quickly create a work around for this type of security model in your system.
Part of the code in this recipe relies on code from the codeunit created in the Checking for user-assigned roles recipe in this chapter.
Create a new table in Object Manager named Field Level Security.
Add the following fields:
Name
Type
Length
Table No.
Integer
Field No.
Integer
Security Type
Option
Applies To
Text
119
Editable
Boolean
Visible
Boolean
Show Text
Boolean
Set the following properties for these fields:
Field Name
Property
Value
Table No.
TableRelation
Object.ID WHERE (Type=CONST(Table))
Field No.
TableRelation
Field.No. WHERE (TableNo=FIELD(Table No.))
Security Type
OptionString
Database User, Windows User
Applies...