office +1 (678) 436-3250
Facebook "Mergetool.com"
Newsletter@mergetool.com

Applying Data Security to reports/Dataports and XML Ports

To implement Data Security filters from NAV Easy Security: Field Level, Actions 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,2,0); // Filter as Form 0
                      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,2,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.



Like   Don't Like

© 2011 Mergetool.com. All rights reserved.



Related resources

Download software from Mergetool.com