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...
Suggested Answer

How to Suspend Status Check for a Purchase Order from a new page.

(0) ShareShare
ReportReport
Posted on by 20
I have created a new page for fast updates for few fields of the header of a Purchase Order.
 
page 50151 /CE Purchase Order Simple/
{
    Caption = 'Purchase Order Simple';
    PageType = List;
    InsertAllowed = false;
    DeleteAllowed = false;
    SourceTable = /Purchase Header/;
    SourceTableView = WHERE(/Document Type/ = CONST(/Order/));
    ApplicationArea = All;
    UsageCategory = Lists;
 
    layout
    {
        area(content)
        {
            repeater(Control1)
            {
                field(/Order Number/; Rec./No./)
                {
                    ApplicationArea = All;
                    Caption = 'Order Number';
                    ToolTip = 'Purchase Order Number';
                    Editable = false;
                    Width = 7;
                }
                field(Status; Rec.Status)
                {
                    ApplicationArea = Suite;
                    ToolTip = 'Specifies whether the record is open, waiting to be approved, invoiced for prepayment, or released to the next stage of processing.';
                    StyleExpr = StatusStyleTxt;
                    Editable = false;
                }
                field(/Vendor/; Rec./Buy-from Vendor No./)
                {
                    ApplicationArea = All;
                    Caption = 'Vendor';
                    ToolTip = 'Specifies the number of the vendor who delivers the products.';
                    Editable = false;
                    Width = 6;
                }
                field(/Vendor Name/; Rec./Buy-from Vendor Name/)
                {
                    ApplicationArea = All;
                    Caption = 'Vendor Name';
                    ToolTip = 'Specifies the name of the vendor who delivers the products.';
                    Editable = false;
                    Width = 30;
                }
                field(/Location/; Rec./Location Code/)
                {
                    ApplicationArea = All;
                    Caption = 'Location';
                    ToolTip = 'Specifies a code for the location where you want the items to be placed when they are received.';
                    Editable = false;
                    Width = 4;
                }
                field(/Requested Receipt Date/; Rec./Requested Receipt Date/)
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies the date that you want the vendor to deliver to the ship-to address.';
                    Width = 12;
                }
                field(/Promised Receipt Date/; Rec./Promised Receipt Date/)
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies the date that the vendor has promised to deliver the order.';
                    Width = 12;
 
                    trigger OnValidate()
                    begin
                        Rec.SuspendStatusCheck(true);
                    end;
                }
            }
        }
    }
    trigger OnAfterGetRecord()
    begin
        StatusStyleTxt := Rec.GetStatusStyleText();
        Rec.SuspendStatusCheck(true);
    end;
 
    trigger OnOpenPage()
    begin
        BindSubscription(CePurchaseSuspendCheck);
    end;
 
    trigger OnClosePage()
    begin
        UnbindSubscription(CePurchaseSuspendCheck);
    end;
 
    var
        CePurchaseSuspendCheck: Codeunit /CE Purchase Suspend Check/;
        StatusStyleTxt: Text;
}
 
However when I change the Promise Receipt Date, I can't Spend the Open Status Check. I tried in the OnAfterGetRecord (doesn't work) and the OnValidate of the field (too late). I have also tried a BindSubscription in the OnOpenPage which works but if I open the Purchase Order List from the Tell Me/Search modal and select one PO from the list and go to edit the Promise Receipt Date on that Card page the Open Status Check is also suspended because my new page is still open in the stack of pages in the UI. I don't UnbindSubscription until my new page closes. I only want the Open Status Check to be suspended if the fields are changes from my new page only. It would be nice if my page could add the OnBeforeValidate trigger like page extensions object can do so I could Spend the Open Status Check from there.
 
Any help would be appreciated.
 
I have the same question (0)
  • Jon A. Profile Picture
    20 on at
    Sorry, I can't get the code to format correctly. Here is also a screenshot:
  • Suggested answer
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at
    Hi, I think trigger OnValidate() should be feasible. . . .
    Or you can change your mind, for example, put this control on the table.
     
    Hope this helps.
    Thanks.
    ZHU
  • Jon A. Profile Picture
    20 on at
    Thank you Yun Zhu for replying. However I think your solution would affect all Purchase Header "Promise Receipt Date" changes across the whole application.
    I'm just looking to suspend the check if the changes happen from my new page.
     
    If this worked it would be ideal

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 3,226

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,047 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,257 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans