Skip to main content
Solved

Sales order customization project

  • Oct 11, 2021 7:39 PM UTC
  • 3 replies
  • 489 views
  • Translate All

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!

Best answer by mvolshteyn

@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:

 

View original

3 replies

Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • Oct 23, 2021 5:58 AM UTC

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.

 

 

 

Translate

mvolshteyn
Acumatica Moderator
Forum|alt.badge.img+3
  • Technical Account Manager in the ISV Team
  • Answer
  • Oct 25, 2021 8:56 AM UTC

@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:

 

Translate

Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • Oct 25, 2021 9:10 AM UTC

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. 

Translate