Control permission on ledger entries based on user setup - NAV 2016

poppinspoppins Member Posts: 647
Hi everyone,

I have the following request from a customer:

Based on a boolean on user setup, the user should/should not be able to "see" Vendor ledger entries:
for example: when the boolean is off:
- The user gets nothing when he tries to access the vendor ledger entries from vendor card.
- The Vendor ledger entry list shows empty.
- .....

Is this achievable in NAV 2016?

Answers

  • KishormKishorm Member Posts: 921
    Yes, you could add some code to the OnOpenPage() trigger of the "Vendor Ledger Entries" Page (29) to set a filter which would return no records, make sure you do this in a FILTERGROUP though so that the user cannot clear the filter. It would be something along the lines of...
    IF NOT UserSetup.GET(USERID) THEN
      CLEAR(UserSetup);
    IF NOT UserSetup."Allow Access to Vendor Ledger" THEN BEGIN
      FILTERGROUP := 10;
      SETRANGE("Entry No.",-1);
      FILTERGROUP := 0;
    END;
    
  • poppinspoppins Member Posts: 647
    Kishorm wrote: »
    Yes, you could add some code to the OnOpenPage() trigger of the "Vendor Ledger Entries" Page (29) to set a filter which would return no records, make sure you do this in a FILTERGROUP though so that the user cannot clear the filter. It would be something along the lines of...
    IF NOT UserSetup.GET(USERID) THEN
      CLEAR(UserSetup);
    IF NOT UserSetup."Allow Access to Vendor Ledger" THEN BEGIN
      FILTERGROUP := 10;
      SETRANGE("Entry No.",-1);
      FILTERGROUP := 0;
    END;
    

    OK, but why FILTERGROUP := 10?
    Why not FILTERGROUP := 2?
  • KishormKishorm Member Posts: 921
    You could but I prefer to use one that is not used internally by the client - just my preference.
Sign In or Register to comment.