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

Announcements

News and Announcements icon
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
    159 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,096 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,222 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,603 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 1,186 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans