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

Keep Sales Order Open after posting

(3) ShareShare
ReportReport
Posted on by 311
Hello!
 
I was wondering if it is possible to post a Sales Order, but not change the status to 'Released'. I would like to keep the status as 'Open', until it is manually released by pressing the 'Release' button on the Sales Order.
 
How can I achieve this without putting myself in an infinite loop using AL?
I have the same question (0)
  • Verified answer
    Khushbu Rajvi. Profile Picture
    20,275 Super User 2025 Season 2 on at
  • Suggested answer
    YUN ZHU Profile Picture
    95,331 Super User 2025 Season 2 on at
    The system will check the status of the order when posting. If it is not released, it cannot be posted (this is also controlled in Workflow)
    So instead of bypassing this check, you can do the following in AL.
    After the release is successful, find this order, open it, and you're done.
     
    Hope this can give you some hints.
    Thanks.
    ZHU
  • Suggested answer
    Ramesh Kumar Profile Picture
    7,527 Super User 2025 Season 2 on at
    In standard Business Central, you need to release the order before posting a shipment or invoice. However, this can be achieved through custom code, allowing orders to remain open via a job queue for all invoiced or shipped orders.
     
    If this helped you, please check the box Does this answer your question?
  • Suggested answer
    Jun Wang Profile Picture
    8,200 Super User 2025 Season 2 on at
    Not sure why you need such behavior. There might be other options if you share the business needs. If you want to control posting a sales order, you could also consider using workflow as well. 
  • Suggested answer
    Valentin Castravet Profile Picture
    31,340 Super User 2025 Season 2 on at
    Can you clarify what you're trying to achieve? There may be standard functionality that can accomplish this without the need for customization.
     
  • Hagru Profile Picture
    311 on at
     
    When a Sales Order is posted, the customer wants to keep the Sales Order in the Sales Order list, and keep the Status as Open. Then, at a point further down, they want to manually Release the order by pressing the "Release" button on the order. 
     
    Everything else should work exactly like it is supposed to when posting an order.
  • Hagru Profile Picture
    311 on at
    I verified the answer @Khushbu Rajvi. delivered, as that helped me a lot on the way. I mixed this with another trigger in the Sales-Post CodeUnit, and the results are what I was looking for.
     
    Along with a field in the Sales Setup, this is the final code. I am adding it here both for my own future reference, but also for others that may be looking for a similar solution:
     
     
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", OnBeforeFinalizePosting, '', false, false)]
        local procedure KeepSalesOrdersAfterInvoiced(var EverythingInvoiced: Boolean)
        var
            SalesSetup: Record "Sales & Receivables Setup";
        begin
            SalesSetup.FindFirst();
            if SalesSetup.AllowStatusStayOpen then begin
                EverythingInvoiced := false;
            end;
        end;
     
        [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", OnAfterFinalizePosting, '', false, false)]
        local procedure SetStatusBackToOpen(var SalesHeader: Record "Sales Header")
        var
            SalesSetup: Record "Sales & Receivables Setup";
        begin
            SalesSetup.FindFirst();
            if SalesSetup.AllowStatusStayOpen then begin
                SalesHeader.Status := SalesHeader.Status::Open;
                SalesHeader.Modify();
            end;
        end;
     
    This allows the Sales Order to stay in the list with an Open status, and the user is also allowed to manually Release the Order. 

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,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans