Skip to main content

Notifications

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

  • RajeshReddy Profile Picture
    25 on at
    RE: Update using page action to change Option or Enum Field

    Thank you very much for your help. It worked .

  • Suggested answer
    Vaishnavi J Profile Picture
    3,060 on at
    RE: Update using page action to change Option or Enum Field

    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.
  • Suggested answer
    JAngle Profile Picture
    95 on at
    RE: Update using page action to change Option or Enum Field

    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.

  • RajeshReddy Profile Picture
    25 on at
    RE: Update using page action to change Option or Enum Field

    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.

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

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

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans