Solved

Sales order customization project

  • 11 October 2021
  • 3 replies
  • 329 views

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:

[PXDBString(20)]
[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:

[PXDefault(typeof(Search<ReasonCode.reasonCodeID, 
            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!

icon

Best answer by mvolshteyn 25 October 2021, 10:56

View original

3 replies

Userlevel 7
Badge +17

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 5
Badge +3

@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 +17

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. 

Reply


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 — 2024  Acumatica, Inc. All rights reserved