web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Disabling a page

(0) ShareShare
ReportReport
Posted on by 213

Hello All,

Right now, am trying to Disable a page if the user changed the Status as "Completed", then it should disable for all the users except one User group. If the status was completed, then if any of the users enter to the particular page, it should display who has changed the status and when it was completed.

Now, first part i was completed. Means while changing the Status the page is disabling, But the issue facing is

a)  lines of items and Header menus are not disabled for that particular page and if we click on next and coming back at that time sometimes its not disabling.

b) Name and time Label of the status changed was not getting. 

Kindly requesting your valuable suggestion which i will get desired output

8004.jobss.jpg

pageextension 62001 "Jobs PageDisable" extends "Job Card"
{

    trigger OnOpenPage();
    var

        UserGroupMember: Record "User Group Member";
    begin

        If Rec.Completed then begin
            IF not UserGroupMember.Get('ADMIN', UserSecurityId(), CompanyName) then begin
                CurrPage.Editable := false;
            end
            else
                CurrPage.Editable := true; 
        end; 
    end;

    trigger OnValidate();
    var
        myInt: Integer;
        Confirm: Label 'The Job No :%1  Has been Closed by the User : %2 On Date %3.';
    begin
        If Rec.Completed then begin
            IF not UserGroupMember.Get('ADMIN', UserSecurityId(), CompanyName) then begin
                If Dialog.Confirm(StrSubstNo(Confirm,Rec."No.", Rec.SystemModifiedBy, Rec."Last Date Modified"), false) then begin
                    CurrPage.Update();
                end

            end;
        end;



}

I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    92,161 Super User 2025 Season 2 on at
    RE: Disabling a page

    Hi, Just a little suggestion, hope this helps you.

    Regarding a, Menu cannot be Disabled, so you can prevent the user from opening this page in the program, but the disadvantage is that the user cannot confirm the page data in the case of Completed. If you have specific actions you don't want the user to run, you need to add control code to OnBeforeAction trigger of the menu.

    As for Next and Coming Back, please try adding the control code to the OnNextRecord (Page) Trigger.

    pastedimage1655857156001v1.png

    Regarding b, there is no OnValidate() in the trigger of the page, I'm not sure how you got it to compile.

    pastedimage1655857500340v2.png

    pastedimage1655857521357v3.png

    PS: If you want to determine whether the user is a Super user, you can refer to the following method.

    https://yzhums.com/25886/

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,037 Moderator on at
    RE: Disabling a page

    I think you should try to solve this using a security filter instead.

    You can read more about how they work here:

    docs.microsoft.com/.../security-filters

  • Suggested answer
    Marco Mels Profile Picture
    on at
    RE: Disabling a page

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    www.dynamicsuser.net/.../14

    I will open this up to the community in case they have something to add.

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 3,885

#2
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 3,405

#3
Sumit Singh Profile Picture

Sumit Singh 2,837

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans