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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Update using page action to change Option or Enum Field

(0) ShareShare
ReportReport
Posted on by 25

pageextension 50101 SOStatus extends "sales order"
{
    layout
    {
        addlast(General)
        {
            group("Order Status")
            { 
            field(SOStatus; rec.SOStatus)
            {
                ApplicationArea = All;
                ToolTip = 'Sales Order Status';
                Editable = true;
            }
            }
        }
    }
    actions
    {
        addfirst(navigation)
        {
            group(Status)
            {
                Caption = 'Status';
                Image = Status;
                Enabled = true;
                action("Accept Order")
                {
                    ApplicationArea = All;
                    Promoted = true;
                    Enabled = rec.SOStatus <> Rec.SOStatus::Accepted;
                    PromotedCategory = Category13;
                    PromotedIsBig = true;
                    PromotedOnly = true;
                    Caption = 'Accept';
                    Image = Approval;
                    trigger OnAction()
                    begin
                        Rec.Modify(Rec.SOStatus <> Rec.SOStatus::Accepted)
                    end;
                }
                action("Reject Order")
                {
                    ApplicationArea = All;
                    Promoted = true;
                    Enabled = Rec.SOStatus <> Rec.SOStatus::Rejected;
                    PromotedCategory = Category13;
                    PromotedIsBig = true;
                    PromotedOnly = true;
                    Caption = 'Reject';
                    Image = Reject;
                    trigger OnAction()
                    begin
                        Rec.Modify(Rec.SOStatus <> Rec.SOStatus::Rejected)
                    end;
                }

            }
        }
    }
}









Web-capture_5F00_3_2D00_3_2D00_2022_5F00_121139_5F00_businesscentral.dynamics.com.jpeg

I have the same question (0)
  • RajeshReddy Profile Picture
    25 on at

    I tried to change SOStatus using the page action. But it is not updating the field. Please Help me

    how to make this work.

    Thanks in Advance.

  • Suggested answer
    JAngle Profile Picture
    133 on at

    Rec.modify accepts a Boolean result. So you are setting that but not the actual field. You should have a line before

    Rec.SOStatus := Rec.SOStatus::Accepted;

    Rec.modify();

    Same pattern for the rejected page action.

  • Suggested answer
    Vaishnavi J Profile Picture
    3,062 on at

    Hi,  

    Can you write the logic in this way

    addlast(General)

            {
                group("Order Status")
                {
                    field(SOStatus; rec.SOStatus)
                    {
                        ApplicationArea = All;
                        ToolTip = 'Sales Order Status';
                        Editable = true;
                    }
                }
            }
        }
        actions
        {
            addfirst(navigation)
            {
                group(Status)
                {
                    Caption = 'Status';
                    Image = Status;
                    Enabled = true;
                    action("Accept Order")
                    {
                        ApplicationArea = All;
                        Promoted = true;
                        Enabled = rec.SOStatus <> Rec.SOStatus::Accepted;
                        PromotedCategory = Category13;
                        PromotedIsBig = true;
                        PromotedOnly = true;
                        Caption = 'Accept';
                        Image = Approval;
                        trigger OnAction()
                        begin
                            Rec.SOStatus := Rec.SOStatus::Accepted;
                            Rec.Modify();
                        end;
                    }
                    action("Reject Order")
                    {
                        ApplicationArea = All;
                        Promoted = true;
                        Enabled = Rec.SOStatus <> Rec.SOStatus::Rejected;
                        PromotedCategory = Category13;
                        PromotedIsBig = true;
                        PromotedOnly = true;
                        Caption = 'Reject';
                        Image = Reject;
                        trigger OnAction()
                        begin
                            Rec.SOStatus := Rec.SOStatus::Rejected;
                            Rec.Modify();
                        end;
                    }

                }
            }
        }
    If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much.
  • RajeshReddy Profile Picture
    25 on at

    Thank you very much for your help. It worked .

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,468

#2
YUN ZHU Profile Picture

YUN ZHU 923 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 607

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans