Skip to main content
Answer

Query last sold info for sales order line

  • October 11, 2021
  • 2 replies
  • 95 views

I am trying to add some more info to the Availability status at the bottom of Sales Order - Details grid. 

Specifically, I am trying to pull the last sold cost for the sales order header’s customer and the sales order detail/line inventory ID field. Is there an imbedded way/function to load this price or will this require the PXSelect methodology? Thanks!

Best answer by Naveen Boga

Hi @ryanmoon32  I have NOT tried this method, but this method will gives you the previous records values. Can you please check and verify. 

public void _(Events.RowPersisting<SOLine> e)
{
var line = e.Row;

if (line == null) return;

var persistedLine = (SOLine)e.Cache.GetOriginal(line);


}

 

2 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • Answer
  • October 12, 2021

Hi @ryanmoon32  I have NOT tried this method, but this method will gives you the previous records values. Can you please check and verify. 

public void _(Events.RowPersisting<SOLine> e)
{
var line = e.Row;

if (line == null) return;

var persistedLine = (SOLine)e.Cache.GetOriginal(line);


}

 


Forum|alt.badge.img+5
  • Jr Varsity II
  • October 12, 2021

If I am understanding correctly you are looking to basically surface the most recent sales price for a given customer/inventory item combination?

I don’t believe there is any sort of native functionality for this so you would have to use BQL or FBQL to retrieve the most recent SOLine and graph the price from that.