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 :
Microsoft Dynamics AX (Archived)

Copy/Split a Sales Order

(0) ShareShare
ReportReport
Posted on by 5

Good Day Fellow Community,

(AX Dynamics 2012 CU13)

I have run across a need to add the functionality of splitting a sales order (due to backordered items). Our current process of this involves completely creating a new sales order that shares the same customer and patient information as the original order, providing way too much room for error. I have done some research to see what out-of-the-box AX provides regarding this circumstance, and found the "Copy Sales Order" button could be somewhat of a solution. Though this works, there is still much room for error, as when this process is used a new sales order must still be made under the right customer account and with a new PO, as well as split items must be removed from the old order.

Another solution that I have found and tested can be found here: http://axguruu.blogspot.com/2014/06/creating-new-sales-order-by-copying.html

Following the instructions found on the site, it successfully creates a new order with the items from the old order, but fails to pull over the patient name, patient address, and numerous other fields that are used frequently. What it does pull over is the header-level customer information such as name and address and uses that as the patient details. I have spent quite some time on customizing this author's process in attempt to fit our needs, but I am afraid I am not familiar enough with the numerous classes being called in the creation of a new sales order. 

What I have managed to do is absolutely not best practice, but somewhat works while leaving a lot of holes for things to go wrong. I have it so when the user clicks the checkbox and enters the sales order number, the "Add New Address" form appears. In this form I have added a text box that references the sales order on the parent form, then another checkbox that populates all of the address fields with the original address info when checked, then closes the form. I have done this because I am unsure how to ensure that all of the address information writes to the necessary tables. Though this botchy solution may cover the address problem, it does not solve the bigger issue. I am looking to have every field in all of the fast tabs on the New Sales Order form to be populated with the exact data from the old sales order, as well as have the items and qty's carried over. Would anyone have a much simpler/best practice way to go about this?

Thank You!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    André Arnaud de Calavon Profile Picture
    300,904 Super User 2025 Season 2 on at

    Hi ddoug,

    When you are not experienced enough, creating customizations might be tricky and you can easily create bugs in the system. So, please test all happy and unhappy flows carefully. Also note that if you leave the backordered items open, the process would already know that there are items left for delivery.

    When I do read your requirement, there are some questions that comes into my mind. When you do split a sales order, will always be the backordered items be fully transferred to the new sales order? Or just some lines or a part of the backordered items. My first thought would be creating a function called "Transfer backordered items to new sales order". This function should create a new order with all details from the original header and only create lines for the backordered items as transfer. Then also the delivery remainder of the original sales lines should be deducted.

    If you want to continue with the solution from the axguruu blog, you can add some additional fields to be copied in the modified() method. Patient information is not standard AX functionality, that is part of a customization or add-on in your environment. It would be possible to copy field values just before the "SalesTable.insert();" statement.

    Example (if patient information is also added to the SalesTable table - I don't know which field names are used, so did an assumption for one field name):

    salesTable.Patient = salesTableBuff.Patient;

    You can add more lines with other fields to be copied. The copy functionality provided within the blog post is not aware of the backorder status of each order line, so currently there is room for errors on typing the quantities.

    Hope this answer will help you.

  • ddoug Profile Picture
    5 on at

    Hello Andre,

    Thank you very much for your response, and I apologize for the delay in mine. When we use this feature, we are wanting to be able to choose what items will be carried over to the new order. I have decided upon a hybrid of what you have mentioned and another idea from my boss. Our customer service team is aware of what the backorder status of each line is, so we are good on that front, and can avoid a coded option. New thoughts are to create a new button on the salestablelistpage that will take the selected order on the grid and copy it to a new order in its own. In doing that, buffers will be used as you mentioned above to copy over all patient and customer information to the new sales order. Also, upon clicking the button, a new form will appear allowing the user to choose which items and qty's should be moved to the new sales order. Doing this allows us to hedge for future problems that we might want to utilize this feature for, other than backorders. I plan to still use some of the code posted in the Axguruu blog, even though a different approach will be taken.

    Thank you again!

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans