Make a page non-editable to a user in Microsoft Dynamics NAV2018

customized a table called Quantumjumps User Setup with these fields (1.) User ID (Code = 50), Employee No. (Code=20), Allow Modify (Boolean) and Page Where I checked the a user and unchecked other user.

I declare User record Quantumjumps User Setup in the page global variable

I wrote my code in the OnOpenPage()

IF User.GET(USERID) THEN 
  CurrPage.EDITABLE := User."Allow Modify";

It working fine but I have a cue of the same page in my customized Role Center, when I clicked the cue its permitted the unchecked user to create new, edit and others but when He clicked from the customized navigation pane or search the page from the search bar. It llnt be able to create new, edit or other

The two users are Super role. And when I set the unchecked user to Basic role, I didnt see my customized menus(pages) in the Role Center.

Please Team, How can I solve this problem.

Thanks.

The correct way obvious is to change the permissions of the users who should not be able to modify the record.

Or as an alternative, create two versions of the page.

I said once I change the permission of the unchecked user to Basic, The customized pages in the customized navigation pane will not be seen.

I dnt want to create two versions of page.

Why not to make a custom Roles and Permission for this. Later too you can use this Role to assign it to someone else if needed!!

It is good to write like “IF .GET THEN”… but you need to set “ELSE CurrPage.EDITABLE :=FALSE”

  • if I remember correctly I used OnInit() trigger for it.

I wrote the below code under PAGE: OnInit() trigger. I appreciate, Thanks

OnInit()

IF User.GET(USERID) THEN BEGIN
  IF User."Allow Modify" = TRUE THEN
    CurrPage.EDITABLE := TRUE
  ELSE
    CurrPage.EDITABLE := FALSE
  END;

Why so many lines of code? This does the exact same thing. But shorter and easier to read. [emoticon:c4563cd7d5574777a71c318021cbbcc8]

IF User.GET(USERID) THEN 
  CurrPage.EDITABLE := User."Allow Modify";

OnInit()

IF NOT User.GET(USERID) THEN
CurrPage.EDITABLE := FALSE
ELSE
CurrPage.EDITABLE := User.“Allow Modify”;