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!

  • rajivsewsarran Profile Picture
    22 on at
    RE: Updating dates on Sales Orders

    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;

  • Suggested answer
    Inge M. Bruvik Profile Picture
    999 Moderator on at
    RE: Updating dates on Sales Orders
    [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
    RE: Updating dates on Sales Orders

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

  • Suggested answer
    Inge M. Bruvik Profile Picture
    999 Moderator on at
    RE: Updating dates on Sales Orders

    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;
        
    }
    

  • Suggested answer
    DAnny3211 Profile Picture
    9,274 Moderator on at
    RE: Updating dates on Sales Orders

    hello

    you must ask your partner to develop a pesrosnalisation

    DAniele

  • rajivsewsarran Profile Picture
    22 on at
    RE: Updating dates on Sales Orders

    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
    S.Kawamura Profile Picture
    1,520 on at
    RE: Updating dates on Sales Orders

    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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,278 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,983 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans