Solved

customization

  • 18 September 2023
  • 2 replies
  • 54 views

Userlevel 1

how to check two DAC values is equal in acumatica using if condition?

 

ex: If the preferred warehouse is not matched between the sales order and transfer, 

it should not allow me to key the transfer ref no in the sales order line,

Likewise, the SOnbr should not show in the transfer record either

If the preferred warehouse is not matched between the sales order and transfer, 

it should not allow me to key the transfer ref no in the sales order line,

Likewise, the SOnbr should not show in the transfer record either

icon

Best answer by Naveen Boga 18 September 2023, 13:07

View original

2 replies

Userlevel 7
Badge +10

Hi @tharinduweerasooriya90 

You need to create extension of DAC and then Custom fields will be accessible.

  SOLine item = e.Row;
SOLineExt itemExt = PXCache<SOLine>.
GetExtension<SOLineExt>(item);

Regards,

Sweta

Userlevel 7
Badge +17

@tharinduweerasooriya90   In Acumatica, it's important to avoid writing queries within the RowSelected Event, as doing so can result in performance issues and is not the appropriate place for value assignment.

Given that your requirement relies on comparing warehouses between Sales Order Line and INTran, I've created two events with a common method. Please feel free to adjust the logic to suit your specific needs.

Please find the updated code below for reference.

 

 public class INIssueEntryExt : PXGraphExtension<INIssueEntry>
{
protected void INTran_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated baseMethod)
{
baseMethod?.Invoke(cache, e);
var row = (INTran)e.Row;
if (row == null) return;
}

protected void INTran_SiteID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated baseMethod)
{
baseMethod?.Invoke(cache, e);
var row = (INTran)e.Row;
if (row == null) return;
AssignSONbr(cache, row);
}

private void AssignSONbr(PXCache cache, INTran row)
{
SOLine sOLine = PXSelect<SOLine, Where<SOLineExt.usrTransferNbr, Equal<Required<SOLineExt.usrTransferNbr>>,
And<SOLine.inventoryID, Equal<Required<SOLine.inventoryID>>>>>.Select(Base, row.RefNbr, row.InventoryID);
if (sOLine != null && (sOLine.SiteID == row.SiteID))
{
INTranExt iNTranExt = row.GetExtension<INTranExt>();
SOLineExt soLineExt = row.GetExtension<SOLineExt>();
iNTranExt.UsrSONbr = soLineExt.OrderNbr;
cache.SetValueExt<INTranExt.usrSONbr>(row, iNTranExt.UsrSONbr);
}
}
}

 

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