In the usersetup table create a boolean field for example called Field access, then based on the permission set when you open a form, onopen form trigger check for the permission in the user setup table. If its false then use the currform.<field>.visible := false
Second option would be use the same boolean field in the user setup table. When the user tries to enter a value, on validate trigger of the field check for the user setup permission and flag an error.
The aforementioned solution works for card type forms. To make it work for tabular type forms, In the onformat property for the form control, check the permissions, and if they don't have permission (on the user table as mentioned above, or in another way as below), blank it out. Also disable the control on the OpenForm trigger.
If you can work it into your architecture, another way to do field level security is to use the permissions of another table to achieve the above mentioned code. For instance in one installation, there were certain users who were not allowed to view pricing. There was a custom table created for another pricing scheme. I created a group called OZ-PRICING. I gave read write permissions to the table under that group. I then checked the users permissions on that table when formatting the form, etc.
Keep in mind though that this will only work if you can nail down a group of fields throughout the database to associate with another permission. Otherwise, use the above mentioned implementation.
If you need only insert, modify, delete permission (not read), then you can make extra module for it (we have one). It is based on change log functionality, but it is not depending on the change log. I used the global triggers in CU 1 in same way as change log. Comparing old and new record with FieldRef and checking which fields are empty or changed etc. I say if the user have right or not...
Comments
In the usersetup table create a boolean field for example called Field access, then based on the permission set when you open a form, onopen form trigger check for the permission in the user setup table. If its false then use the currform.<field>.visible := false
Second option would be use the same boolean field in the user setup table. When the user tries to enter a value, on validate trigger of the field check for the user setup permission and flag an error.
SB.
If you can work it into your architecture, another way to do field level security is to use the permissions of another table to achieve the above mentioned code. For instance in one installation, there were certain users who were not allowed to view pricing. There was a custom table created for another pricing scheme. I created a group called OZ-PRICING. I gave read write permissions to the table under that group. I then checked the users permissions on that table when formatting the form, etc.
Keep in mind though that this will only work if you can nail down a group of fields throughout the database to associate with another permission. Otherwise, use the above mentioned implementation.
Mike
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.