Skip to main content

Notifications

Community site session details

Community site session details

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

Creating an assisted setup wizard - fields not editable

(0) ShareShare
ReportReport
Posted on by

I'm building an extension with an assisted setup wizard. I've followed a few different tutorials and gotten the same issue so I must be missing something. I have a table to store the setup values, and a setup wizard page. When I launch in BC the wizard runs properly but the fields aren't editable. Same thing happens if I create a card instead of a setup wizard...

Here is my setup table:

table 50202 "CGO Setup"
{
    Caption = 'CoGo Setup';
    DataClassification = SystemMetadata;

    fields
    {
        field(1; "Priority Code"; Code[20])
        {
            Caption = 'Priority Code';
            TableRelation = "DAM Work Order Priority";
            DataClassification = SystemMetadata;
        }
        field(2; "Load Sample Data"; Boolean)
        {
            Caption = 'Load Sample Data';
            DataClassification = SystemMetadata;
        }
    }
}

Here is my Setup Wizard page:

page 50204 "CGO Setup Wizard"
{
    Caption = 'CoGo Setup Wizard';
    PageType = NavigatePage;
    SourceTable = "CGO Setup";
    SourceTableTemporary = true;
    UsageCategory = Administration;
    ApplicationArea = all;

    layout
    {
        area(Content)
        {
            group(StandardBanner)
            {
                Visible = TopBannerVisible and not FinishActionEnabled;
                Caption = '';
                Editable = false;
                field(MediaResourcesStd; MediaResourcesStd."Media Reference")
                {
                    ApplicationArea = All;
                    Editable = false;
                    ShowCaption = false;
                }
            }
            group(FinishedBanner)
            {
                Visible = TopBannerVisible and FinishActionEnabled;
                Caption = '';
                Editable = false;
                field(MediaResourcesDone; MediaResourcesDone."Media Reference")
                {
                    ApplicationArea = All;
                    Editable = false;
                    ShowCaption = false;
                }
            }
            group(Step1)
            {
                Visible = Step1Visible;
                group("Welcome to CoGo Setup!")
                {
                    Caption = 'Welcome to CoGo Setup';
                    InstructionalText = '';
                }
                group("Let's go!")
                {
                    Caption = 'Let''s go!';
                    InstructionalText = '';
                }
            }
            group(Step2)
            {
                Visible = Step2Visible;
                Caption = '';
                InstructionalText = '';

                field("Priority Code"; rec."Priority Code")
                {
                    ApplicationArea = all;
                    TableRelation = "DAM Work Order Priority".Code;
                }
            }
            group(Step3)
            {
                Visible = Step3Visible;
                Caption = 'System Sample Data';
                InstructionalText = '';
                field("Load Sample Data"; rec."Load Sample Data")
                {
                    ApplicationArea = all;
                    trigger OnValidate()
                    begin
                        if rec."Load Sample Data" then begin
                            Message('Loading Sample Data...');
                        end;
                    end;
                }
            }
            group(Step4)
            {
                Visible = Step4Visible;
            }
        }
    }
    actions
    {
        area(processing)
        {
            action(ActionBack)
            {
                ApplicationArea = All;
                Caption = 'Back';
                Enabled = BackActionEnabled;
                Image = PreviousRecord;
                InFooterBar = true;
                trigger OnAction();
                begin
                    NextStep(true);
                end;
            }
            action(ActionNext)
            {
                ApplicationArea = All;
                Caption = 'Next';
                Enabled = NextActionEnabled;
                Image = NextRecord;
                InFooterBar = true;
                trigger OnAction();
                begin
                    NextStep(false);
                end;
            }
            action(ActionFinish)
            {
                ApplicationArea = All;
                Caption = 'Finish';
                Enabled = FinishActionEnabled;
                Image = Approve;
                InFooterBar = true;
                trigger OnAction();
                begin
                    FinishAction();
                end;
            }
        }
    }
    var
        TopBannerVisible: Boolean;
        BackActionEnabled: Boolean;
        FinishActionEnabled: Boolean;
        NextActionEnabled: Boolean;
        Step1Visible: Boolean;
        Step2Visible: Boolean;
        Step3Visible: Boolean;
        Step4Visible: Boolean;
        Step: Option Start,Step2,Step3,Finish;
        MediaRepositoryDone: Record "Media Repository";
        MediaRepositoryStd: Record "Media Repository";
        MediaResourcesDone: Record "Media Resources";
        MediaResourcesStd: Record "Media Resources";

    trigger OnInit();
    begin
        LoadTopBanners();
        ShowStep1();
    end;

    local procedure LoadTopBanners();
    begin
        if MediaRepositoryStd.Get('AssistedSetup-NoText-400px.png',
        Format(CurrentClientType())) and
        MediaRepositoryDone.Get('AssistedSetupDone-NoText-400px.png',
        Format(CurrentClientType()))
        then
            if MediaResourcesStd.Get(MediaRepositoryStd."Media Resources Ref") and
                MediaResourcesDone.Get(MediaRepositoryDone."Media Resources Ref")
            then
                TopBannerVisible := MediaResourcesDone."Media Reference".HasValue();
    end;

    local procedure NextStep(Backwards: Boolean);
    begin
        if Backwards then
            Step := Step - 1
        else
            Step := Step   1;

        EnableControls();
    end;

    local procedure EnableControls();
    begin
        ResetControls();

        case Step of
            Step::Start:
                ShowStep1();
            Step::Step2:
                ShowStep2();
            Step::Step3:
                ShowStep3();
            Step::Finish:
                ShowStep4();
        end;
    end;

    local procedure ShowStep1();
    begin
        Step1Visible := true;

        FinishActionEnabled := false;
        BackActionEnabled := false;
        NextActionEnabled := true;
    end;

    local procedure ShowStep2();
    begin
        Step2Visible := true;
    end;

    local procedure ShowStep3();
    begin
        Step3Visible := true;
    end;

    local procedure ShowStep4();
    begin
        Step4Visible := true;

        NextActionEnabled := false;
        FinishActionEnabled := true;
    end;

    local procedure ResetControls();
    begin
        FinishActionEnabled := false;
        BackActionEnabled := true;
        NextActionEnabled := true;

        Step1Visible := false;
        Step2Visible := false;
        Step3Visible := false;
        Step4Visible := false;
    end;

    local procedure FinishAction();
    begin
        StoreRecordVar();
        CurrPage.Close();
    end;

    local procedure StoreRecordVar();
    var
        RecordVar: Record "CGO Setup";
    begin
        if not RecordVar.Get() then begin
            RecordVar.Init();
            RecordVar.Insert();
        end;

        RecordVar.TransferFields(Rec, false);
        RecordVar.Modify(true);
    end;
}

And this is what I get:

pastedimage1643736901773v1.png

pastedimage1643736920994v2.png

Any idea why the fields are not editable?

Thanks!

  • Suggested answer
    YUN ZHU Profile Picture
    83,072 Super User 2025 Season 1 on at
    RE: Creating an assisted setup wizard - fields not editable

    Hi, I reconfirmed the content of my post and it seems to be fine. Hope this gives you some inspiration.

    https://yzhums.com/2883/

    pastedimage1643762551327v1.png

    Source Code:

    page 50100 "General Ledger Setup Wizard"
    {
        Caption = 'General Ledger Setup Wizard';
        PageType = NavigatePage;
        SourceTable = "General Ledger Setup";
        SourceTableTemporary = true;
        UsageCategory = Administration;
        ApplicationArea = All;
    
        layout
        {
            area(content)
            {
                group(StandardBanner)
                {
                    Caption = '';
                    Editable = false;
                    Visible = TopBannerVisible and not FinishActionEnabled;
                    field(MediaResourcesStandard; MediaResourcesStandard."Media Reference")
                    {
                        ApplicationArea = All;
                        Editable = false;
                        ShowCaption = false;
                    }
                }
                group(FinishedBanner)
                {
                    Caption = '';
                    Editable = false;
                    Visible = TopBannerVisible and FinishActionEnabled;
                    field(MediaResourcesDone; MediaResourcesDone."Media Reference")
                    {
                        ApplicationArea = All;
                        Editable = false;
                        ShowCaption = false;
                    }
                }
    
                group(Step1)
                {
                    Visible = Step1Visible;
                    group("Welcome to General Ledger Setup Wizard")
                    {
                        Caption = 'Welcome to General Ledger Setup Wizard';
                        Visible = Step1Visible;
                        group(Welcome)
                        {
                            ShowCaption = false;
                            InstructionalText = 'You can setup General Ledger Setup now.';
                        }
                    }
                    group("Let's go!")
                    {
                        Caption = 'Let''s go!';
                        group(Group10)
                        {
                            ShowCaption = false;
                            InstructionalText = 'Choose Next to start basic settings for General Ledger.';
                        }
                    }
                }
    
                group(Step2)
                {
                    Caption = 'General';
                    InstructionalText = 'Step2 - Setup General.';
                    Visible = Step2Visible;
    
                    field("Allow Posting From"; Rec."Allow Posting From")
                    {
                        ApplicationArea = All;
                    }
                    field("Allow Posting To"; Rec."Allow Posting To")
                    {
                        ApplicationArea = All;
                    }
                    field("Max. VAT Difference Allowed"; Rec."Max. VAT Difference Allowed")
                    {
                        ApplicationArea = All;
                    }
                    field("LCY Code"; Rec."LCY Code")
                    {
                        ApplicationArea = All;
                    }
                }
                group(Step3)
                {
                    Caption = 'Dimensions';
                    InstructionalText = 'Step3 - Setup dimensions';
                    Visible = Step3Visible;
    
                    field("Shortcut Dimension 3 Code"; Rec."Shortcut Dimension 3 Code")
                    {
                        ApplicationArea = All;
                    }
                    field("Shortcut Dimension 4 Code"; Rec."Shortcut Dimension 4 Code")
                    {
                        ApplicationArea = All;
                    }
                    field("Shortcut Dimension 5 Code"; Rec."Shortcut Dimension 5 Code")
                    {
                        ApplicationArea = All;
                    }
                    field("Shortcut Dimension 6 Code"; Rec."Shortcut Dimension 6 Code")
                    {
                        ApplicationArea = All;
                    }
                }
    
    
                group(Step4)
                {
                    Visible = Step4Visible;
                    group(Group23)
                    {
                        Caption = 'OK';
                        InstructionalText = 'Step4 - You have finished the setup';
                    }
                    group("That's it!")
                    {
                        Caption = 'That''s it!';
                        group(Group25)
                        {
                            ShowCaption = false;
                            InstructionalText = 'To save this setup, choose Finish.';
                        }
                    }
                }
            }
        }
        actions
        {
            area(processing)
            {
                action(ActionBack)
                {
                    ApplicationArea = All;
                    Caption = 'Back';
                    Enabled = BackActionEnabled;
                    Image = PreviousRecord;
                    InFooterBar = true;
                    trigger OnAction();
                    begin
                        NextStep(true);
                    end;
                }
                action(ActionNext)
                {
                    ApplicationArea = All;
                    Caption = 'Next';
                    Enabled = NextActionEnabled;
                    Image = NextRecord;
                    InFooterBar = true;
                    trigger OnAction();
                    begin
                        NextStep(false);
                    end;
                }
                action(ActionFinish)
                {
                    ApplicationArea = All;
                    Caption = 'Finish';
                    Enabled = FinishActionEnabled;
                    Image = Approve;
                    InFooterBar = true;
                    trigger OnAction();
                    begin
                        FinishAction();
                    end;
                }
            }
        }
        trigger OnInit();
        begin
            LoadTopBanners();
        end;
    
        trigger OnOpenPage();
        var
            GeneralLedgerSetup: Record "General Ledger Setup";
        begin
            Rec.Init();
            if GeneralLedgerSetup.Get() then
                Rec.TransferFields(GeneralLedgerSetup);
    
            Rec.Insert();
    
            Step := Step::Start;
            EnableControls();
        end;
    
        var
            Step1Visible: Boolean;
            Step2Visible: Boolean;
            Step3Visible: Boolean;
            Step4Visible: Boolean;
            Step: Option Start,Step2,Step3,Finish;
            BackActionEnabled: Boolean;
            FinishActionEnabled: Boolean;
            NextActionEnabled: Boolean;
            TopBannerVisible: Boolean;
            MediaRepositoryDone: Record "Media Repository";
            MediaRepositoryStandard: Record "Media Repository";
            MediaResourcesDone: Record "Media Resources";
            MediaResourcesStandard: Record "Media Resources";
    
        local procedure EnableControls();
        begin
            ResetControls();
    
            case Step of
                Step::Start:
                    ShowStep1();
                Step::Step2:
                    ShowStep2();
                Step::Step3:
                    ShowStep3();
                Step::Finish:
                    ShowStep4();
            end;
        end;
    
        local procedure StoreRecordVar();
        var
            GeneralLedgerSetup: Record "General Ledger Setup";
        begin
            if not GeneralLedgerSetup.Get() then begin
                GeneralLedgerSetup.Init();
                GeneralLedgerSetup.Insert();
            end;
    
            GeneralLedgerSetup.TransferFields(Rec, false);
            GeneralLedgerSetup.Modify(true);
        end;
    
    
        local procedure FinishAction();
        begin
            StoreRecordVar();
            CurrPage.Close();
        end;
    
        local procedure NextStep(Backwards: Boolean);
        begin
            if Backwards then
                Step := Step - 1
            ELSE
                Step := Step   1;
    
            EnableControls();
        end;
    
        local procedure ShowStep1();
        begin
            Step1Visible := true;
    
            FinishActionEnabled := false;
            BackActionEnabled := false;
        end;
    
        local procedure ShowStep2();
        begin
            Step2Visible := true;
        end;
    
        local procedure ShowStep3();
        begin
            Step3Visible := true;
        end;
    
        local procedure ShowStep4();
        begin
            Step4Visible := true;
    
            NextActionEnabled := false;
            FinishActionEnabled := true;
        end;
    
        local procedure ResetControls();
        begin
            FinishActionEnabled := false;
            BackActionEnabled := true;
            NextActionEnabled := true;
    
            Step1Visible := false;
            Step2Visible := false;
            Step3Visible := false;
            Step4Visible := false;
        end;
    
        local procedure LoadTopBanners();
        begin
            if MediaRepositoryStandard.GET('AssistedSetup-NoText-400px.png', FORMAT(CurrentClientType())) AND
               MediaRepositoryDone.GET('AssistedSetupDone-NoText-400px.png', FORMAT(CurrentClientType()))
            then
                if MediaResourcesStandard.GET(MediaRepositoryStandard."Media Resources Ref") AND
                   MediaResourcesDone.GET(MediaRepositoryDone."Media Resources Ref")
                then
                    TopBannerVisible := MediaResourcesDone."Media Reference".HasValue();
        end;
    }

    Hope this will help.

    Thanks.

    ZHU

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 858

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 569

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans