Skip to main content


Hi Acumatica People,

I am working on a field updated event handler associated with the base order quantity associated with the sales orders lines.

I am a newbie to Acumatica development (took the t190 course) and I want to check the value of an extension column (for specific item classes we will utilize the value in a custom column). 

Here is a condensed version of my problem code: 
------------------------------
  public class SOOrderEntryExt : PXGraphExtension<PX.Objects.SO.SOOrderEntry>
{

      #region Event Handlers

      protected void _(Events.FieldUpdated<SOLine, SOLine.baseOrderQty> e)
      {
          if (e != null) 
          {

          SOLine row = (SOLine)e.Row;

          SOLineExt soLineExt = PXCache<SOLine>.GetExtension<SOLineExt>(row);

------------------------------
I want to view the value in the custom column and throw an exception on the base order quantity column under certain conditions.

I am using PXTrace.WriteInformation calls to check what is going on and it looks like soLineExt is always null (when I know it isn't). 

I don't think I'm properly getting the custom column's cache through this GetExtension invocation above.

How do I obtain the custom column's cache properly?

Hi @PatrickBacon 

Try this way:

protected void _(Events.FieldUpdated<SOLine, SOLine.baseOrderQty> e)
{
if (e.Row != null)
{
SOLine row = (SOLine)e.Row;
SOLineExt soLineExt = e.Cache.GetExtension<SOLineExt>(e.Row);

// soLineExt.UsrField ...

...
}
}
  • Look for the cache used in the event (e.Cache)
  • Validate if the row is null (e.Row). The event variable always has a value but you can also validate for null if feel it necessary.

 


Leo, Thank you for the quick response. I made the modification and started testing and so far, so good.


Reply