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

Updating dates on Sales Orders

(0) ShareShare
ReportReport
Posted on by 22

Hi All,

When a sales order is created from a sales quote, I would like to have the document date updated to "Today's Date"


EG
If i create a sales quote on 12/12/22 and only converted it to a sales order on 12/29/22, i would like the document date to show 12/29/22


How do i go about doing this?

Thanks!

I have the same question (0)
  • Suggested answer
    S.Kawamura Profile Picture
    1,530 on at

    HI,

    Just type and overwrite document date. It's convinient to type "t" instead of typing the date of today.

    So far as I researched, no standard feature exist for such requirement..

    I hope this helps you.

    S.Kawamura

  • rajivsewsarran Profile Picture
    22 on at

    Hey thanks for your response,

    Unfortunately the client wants it automatically populate.

    Can't wrap my mind around how that code should be...

  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at

    hello

    you must ask your partner to develop a pesrosnalisation

    DAniele

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at

    The code to do this is pretty easy. There is an event you can subscribe to that trigges when a quote is made into a sales order. You can simple set the date to today in that event. I am adding some sample code.

    codeunit 55015 QuoteToSalesOrder
    {
    
     [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Quote to Order (Yes/No)", 'OnAfterSalesQuoteToOrderRun', '', false, false)]
     local procedure OnAfterSalesQuoteToOrderRun(var SalesHeader2: Record "Sales Header"; var SalesHeader: Record "Sales Header");
     begin
        SalesHeader.Validate("Document Date",Today);
        SalesHeader.Modify(true);
     end;
        
    }
    

  • rajivsewsarran Profile Picture
    22 on at

    Thanks! ill have a go and let you know how i get on!

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at
    [quote user="rajivsewsarran"]

    Thanks! ill have a go and let you know how i get on!

    [/quote]

    Good, let me know if you need more assistance with it.

  • rajivsewsarran Profile Picture
    22 on at

    Hi Inge,

    Thanks for your help.

    This is what i sued and it worked!

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Quote to Order", 'OnAfterCreateSalesHeader', '', true, true)]

       local procedure OnAfterCreateSalesHeader(var SalesOrderHeader: Record "Sales Header"; SalesHeader: Record "Sales Header")

       begin

           SalesOrderHeader.Validate("Document Date", Today);

           SalesOrderHeader.Modify();

       end;

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

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans