Options

Setting permissions in a form

CannikinCannikin Member Posts: 72
Hey guys,

How can I set the permission level for a field on a form? For example, we have a field that we only want "super users" to be able to edit. Anyone can view, though. Is this something I need to change at the table level?

Any help would be appreciated. :)

Rob

Comments

  • Options
    DenSterDenSter Member Posts: 8,304
    On a form level you d that with permissions. You can set read only permissions on an object level. If you want to do field level security, you'll have to develop something for it.

    Say you want to shield the credit limit field of the Customer Card. You could add an "Allow Credit Limit Edit" field to the user setup table that is only checked for certain users. Then, in the OnOpenForm trigger of the Customer Card, you enter the following code:
    UserSetup.GET(USERID); // rec var of type User Setup
    CurrForm."Credit Limit (LCY)".EDITABLE(UserSetup."Allow Credit Limit Edit");
    
    Or, if you want to go with a bunch of fields:
    UserSetup.GET(USERID);
    IF UserSetup."Allow Credit Limit Edit" THEN BEGIN
      CurrForm."Credit Limit (LCY)".EDITABLE(TRUE);
      CurrForm.Blocked.EDITABLE(TRUE);
    END ELSE BEGIN
      CurrForm."Credit Limit (LCY)".EDITABLE(FALSE);
      CurrForm.Blocked.EDITABLE(FALSE);
    END;
    
    Of course, each user must have a User Setup record in the General Ledger area, or the Customer Card won't even open..
  • Options
    CannikinCannikin Member Posts: 72
    Hmm .. when I try to add that field to the User Setup table, I get an message saying that our license doesn't allow it. :( Any idea what "module" would let me edit that table?
  • Options
    CannikinCannikin Member Posts: 72
    I also can't view any code applied to Forms. I press F9 and nothing happens. I assume this is another license issue?
  • Options
    kinekine Member Posts: 12,562
    To write code you need more than Report and Form designer. You need application builder granule...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    randrewsrandrews Member Posts: 135
    Cannikin wrote:
    I also can't view any code applied to Forms. I press F9 and nothing happens. I assume this is another license issue?
    I see you :) I have the same license and suffer from it. I can't edit User Setup, so I made my own table (my license allow me to add table from 50000 to 50030). But you will not allowed to use it in form C/AL code - only in reports.
Sign In or Register to comment.