How to Extend Sales Order Update Functionality to Custom Fields in Dynamics AX

by | Updated August 15, 2016 | Development, Dynamics AX

I worked on a feature to add custom fields in Dynamics AX to the sales order header and lines. With this customization, there was a requirement that if you were to update the custom field on the sales order header, the value would also transfer to all the sales lines. Dynamics AX already does this for some fields out-of-the-box. In this article, I will show you how you can extend this attribute to your custom fields.

Once you have added the fields to the SalesTable and the SalesLine table and exposed the fields on the SalesTable form, add the new custom field to the HeaderToLineUpdate field group on the SalesTable Table.

Project Sales Table Update in Dynamics AX

In order for the system to recolonize the sales order to line fields that need to be updated, the fields must be set to prompt, or always, in the Account Receivable parameters form. (Accounts receivable – Setup – Accounts receivable parameters – Updates – Update order lines (Button))

To add this field to the update order lines form, you will need to modify the lineUpdateDescription method in the SalesTable2LineField class. Add the following code highlighted below, replacing the SSI_TransDate field with your new custom field.

Classes Sales Table in Dynamics AX

Once this is complete if you go back to the AR parameters form, you will now find your custom field listed on the Update order lines form. Note: make sure to mark the field as prompt.

Update order line in Dynamics AX

The sales order line update process uses the sales order document service, so you will need to add some custom code for the system to copy the value from the sales header to the sales lines.

In the AxSalesTable class I added a new method:

Code in Dynamics AX

In the AxSalesLine class I added the following new method:
Code in Dynamics AX

Code in Dynamics AX

The final piece to the puzzle is to add the set*YourCustomField* method to the setTableFields method in the AxSalesLine class:

Set Your Custom Field

Since you’re are modifying a service document, make sure to run an incremental CIL. But, once this is all complete you should find the sales order update functionality working for your custom fields.

Related Posts

  • Part 1 - Method of Payment in Dynamics AX I recently had a situation during a customer implementation that made me scratch my head. It was concerning receiving cash payments…

  • Over on the AX Support site on MSDN, Daniel Durrer has taken the time to keep tabs on the latest builds for Microsoft Dynamics AX 4.0, 2009 and 2012.  I…

  • Dynamics AX supports the business case of a customer returning goods through the use of a return order. The blog post will start with a customer invoice, then show how…


  1. coder

    Im new into this can explain this code

  2. Brandon Carmichael

    Hello, we’d be happy to help if you could describe specifically what area of the custom fields for sales orders you don’t understand? If you are new to Dynamics AX in general I would recommend looking into our training opportunities or those available from the Dynamics AX user group – AXUG.

    Thanks Brandon!

  3. Nimish

    Hi Jermey,

    The code is working fine but I am getting an the error while saving update order line form.

    Cannot edit a record in Purchase line update parameters (PurchTable2LineParameters).
    The record has never been selected.

    PurchTable2LineParameters is not reflecting new custom field which we move to HeadertoLineupdate group.

    Please advice.

  4. Brandon Carmichael

    Hello Nimish,

    How interesting. Could you please provide us more details on the error, or even a trace?


  5. Nimish

    Hi Brandon,

    Table “PurchTable2LineParameters” does not contain FieldId of custom field that we moved to HeadertoLineupdate group in PurchTable.

    I added it from table browser for one entity and it was working for that entity. When I change entity it throws the same error.
    There must be some method which inserts the Fieldid data into the “PurchTable2LineParameters” table.

  6. Michael Tweiten

    Hello Nimish,

    Were you able to solve this issue or do you need more assistance? If so, can you please provide more detail if possible.


Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events


14jan11:00 am12:00 pmConfab with Stoneridge - Livestream - Looking Forward: Predictions for Technology in 2021

20jan10:00 am10:30 amThe Modern Manufacturer - Demand Forecasting Functionality

27jan12:00 pm12:45 pmFour Keys to Choosing the Best ERP or CRM Solution: Part 1 – Fit

28jan11:00 am12:00 pmConfab with Stoneridge - Livestream - Ask the Experts!


03feb10:00 am10:30 amThe Modern Manufacturer - Enterprise Asset Management

03feb12:00 pm12:45 pmFour Keys to Choosing the Best ERP or CRM Solution: Part 2 – Platform

10feb12:00 pm12:45 pmFour Keys to Choosing the Best ERP or CRM Solution: Part 3 – Implementation Partner

11feb11:00 am12:00 pmConfab with Stoneridge - Livestream - Live Agents, Power Virtual Agents, Omnichannel – Oh My!

16feb12:00 pm12:45 pmFour Keys to Choosing the Best ERP or CRM Solution: Part 4 – Cost

17feb10:00 am10:30 amThe Modern Manufacturer - Machine Maintenance Work Orders

25feb11:00 am12:00 pmConfab with Stoneridge - Livestream - Surfing Through the Dynamics 365 Wave 1 2021 Release

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!