The SQL Server option for Microsoft Dynamics NAV allows you to specify record-level security using the Security Filters field on Permissions. Here we will discuss how to set up these filters and some pitfalls to watch out for when using them.
If you have not done so, create the SAMPLE role as described in the Creating and assigning a security role recipe.
View the permissions for this role.
Using the assist button, set the Security Filter field to filter based on a Service Zone Code equal to the letter 'M'.
Close the Security windows.
Create a new codeunit from Object Designer.
Add the following global variable:
Name
Type
Subtype
Customer
Record
Customer
Add the following code to the
OnRun
trigger:Customer.SETPERMISSIONFILTER; FORM.RUNMODAL(0, Customer);
Save and close the codeunit.
The resulting form will only list a single customer: