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

AL code setting a date field on sales orders, but updating on a copy sales order

(0) ShareShare
ReportReport
Posted on by 2
I have an al code extension that sets a custom date field to /today/ on a sales order creation. However, if someone copies a sales order and copies the header, it overwrites that field with the date from the original order. Is there some way to keep that field from being copied, or is there a way to remove the /copy header/ from the copy selection screen? Any thoughts?
 
Kevin
  • KJ-03062255-0 Profile Picture
    KJ-03062255-0 2 on at
    AL code setting a date field on sales orders, but updating on a copy sales order
    I added the code to the "OnAfterInsert" on the Sales Header table.
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 77,925 Super User 2025 Season 1 on at
    AL code setting a date field on sales orders, but updating on a copy sales order
    Hi, which trigger did you add the code to?
    This code may also be executed when copying document, you can move it to trigger which has nothing to do with Copy Document.
     
    Hope this can give you some hints.
    Thanks.
    ZHU

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,309 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans