Sales order customization project

  • 11 October 2021
  • 3 replies

I have added a field (Profit Center) to the Sales Order header and detail tables. 

After requiring the field on the header, that field is then used as the default for the corresponding field when the user is adding detail lines to the sales order. This functionality is correctly working for all scenarios EXCEPT for the very first record when the header is unsaved.. Once the header is saved, then upon creating a detail record the field is correctly defaulted. Both fields have the same underlying data and work as intended on their own as selector controls. 


Here is what is weird.. When entering a new header and before saving once you add a record in the Document Details grid, the first record does NOT default correctly. If you delete that record and then use the Add Row button, the new record now defaults correctly. 


Here is the code for the SO.SOOrder DAC extension:

[PXSelector(typeof(Search<ReasonCode.reasonCodeID, Where<ReasonCode.usage, Equal<ReasonCodeUsages.sales>>>), typeof(ReasonCode.reasonCodeID), typeof(ReasonCode.descr))]
[PXUIField(DisplayName="Profit Center")]


Here is the code for the SO.SOLine DAC extension:

            Where<ReasonCode.reasonCodeID, Equal<Current<SOOrderExt.usrCostCenter>>>>), 
            PersistingCheck = PXPersistingCheck.Nothing)]
[PXSelector(typeof(Search<ReasonCode.reasonCodeID, Where<ReasonCode.usage, Equal<ReasonCodeUsages.sales>>>), typeof(ReasonCode.reasonCodeID), typeof(ReasonCode.descr))]


Thanks in advance!


Best answer by mvolshteyn 25 October 2021, 10:56

View original

3 replies

Userlevel 7
Badge +12

Hi @ryanmoon32  I have tried same example and it is properly defaulting the value at SOLine level from SOOrder header level before saving the document.


I do NOT see any issue with this code. Please find the screenshots for reference.




Userlevel 4
Badge +2

@Naveen B , I was able to reproduce this behavior under the entry of sales order line just after header entry

@ryanmoon32 , please check that CommitChanges in .aspx for the ‘parent’ field (in the Sales Order header) is set to True:


Userlevel 7
Badge +12

Yes @mvolshteyn  To work with the events, CommitChanges = True should be necessary.

@ryanmoon32  If you are NOT already provided at .aspx page, Please provide this attribute for the header field and verify. 


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved