Search:

Applying Data Security to reports/Dataports and XML Ports

To implement Data Security filters from NAV Easy Security: Field Level and Data Security is very little code required.

The example below is showing the code implemented on a report looping on the customer table.

--- Before ----
      {
        DataItemTable=Table18;
        ReqFilterFields=No.;
        GroupTotalFields=No.;
--- After -----
      {
        DataItemTable=Table18;
        OnPreDataItem=BEGIN
                        ESFLADSSetFilters.Filter18(Customer,8,0); // Filter as Page 0, Form=2, Page=8
                      END;

        ReqFilterFields=No.;
        GroupTotalFields=No.;
---------------

--- Before ----
  CODE
  {

    BEGIN
--- After -----
  CODE
  {
    VAR
      ESFLADSSetFilters@1240520008 : Codeunit 14123812;

    BEGIN
---------------

There is basically 2 changes required.
1: Create a global variable "ESFLADSSetFilters" of the type Codeunit 14123812.

2: Call the Codeunit in the from the "OnPreDataItem" trigger. Each table setup in Source Table Setup is going to have a function like the "Filter18" that apply filters to variables of the table Customer (18).
There is three parameters for the function call "ESFLADSSetFilters.Filter18(Customer,8,0);"
1: The Variable the filter is going to be applied to (this should be the looping variable in the report).
2: The object type to apply filter as Form=2 and Page=8. This matches the record in the Data Security Object table.
3: The object ID to apply filter as. This matches the record in the Data Security Object table.

This code is not implemented by the FLADS install engine and is not planned for future versions either. A programmer must implement and remove this manually.



Like   Don't Like

© 2024 Mergetool.com. All rights reserved.



Related resources

Download software from Mergetool.com