Skip to main content
Solved

How can I skip base logic in SOLine_RowUpdated event?

  • October 19, 2020
  • 2 replies
  • 291 views

I have a custom code in SOLine_RowUpdated event, my code works fine and that's all I need, but when I finally get the expected value on SOLine.curyUnitPrice field the base event or base logic changes the value.

I would like to know how can I skip the base event or base logic so that my value doesn't change.

This is my SOOrderEntry_Extension graph:

 

using System;

using System.Collections;

using System.Collections.Generic;

using System.Diagnostics;

using System.Linq;

using System.Text;

using PX.Common;

using PX.Data;

using PX.Objects.AP;

using PX.Objects.AR;

using PX.Objects.CA;

using PX.Objects.CM;

using PX.Objects.CR;

using PX.Objects.CS;

using PX.Objects.DR;

using PX.Objects.EP;

using PX.Objects.GL;

using PX.Objects.IN;

using PX.Objects.PM;

using PX.Objects.PO;

using PX.Objects.TX;

using POLine = PX.Objects.PO.POLine;

using POOrder = PX.Objects.PO.POOrder;

using System.Threading.Tasks;

using PX.CarrierService;

using CRLocation = PX.Objects.CR.Standalone.Location;

using PX.Objects.AR.CCPaymentProcessing;

using PX.Objects.AR.CCPaymentProcessing.Common;

using PX.Objects.AR.CCPaymentProcessing.Helpers;

using PX.Objects.AR.CCPaymentProcessing.Interfaces;

using ARRegisterAlias = PX.Objects.AR.Standalone.ARRegisterAlias;

using PX.Objects.AR.MigrationMode;

using PX.Objects.Common;

using PX.Objects.Common.Discount;

using PX.Objects.Common.Extensions;

using PX.Objects.IN.Overrides.INDocumentRelease;

using PX.CS.Contracts.Interfaces;

using Message = PX.CarrierService.Message;

using PX.TaxProvider;

using PX.Data.DependencyInjection;

using PX.LicensePolicy;

using PX.Objects.Extensions.PaymentTransaction;

using PX.Objects.SO.GraphExtensions.CarrierRates;

using PX.Objects.Common.Bql;

using PX.Objects;

using PX.Objects.SO;



namespace PX.Objects.SO

{

  public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>

  {

    #region Event Handlers

  

    protected void SOLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)

    {

      /*if(InvokeBaseHandler != null)

        InvokeBaseHandler(cache, e);*/



      var row = (SOLine)e.Row;



      if (row == null)

        {

            return;

        }



        if (row.SubItemID == null) 

        {

            row.CuryUnitPrice = (decimal?) 0.00;

            return;

        }



        if (row.SubItemID != null)

        {

            if (row.SiteID == null)

            {

                row.CuryUnitPrice = (decimal?) 0.00;

                return;

            }

            

            if (row.OrderQty > 0)

            {

                    return;

            }

            else 

            {

                    string cadena = "MAIN";

                    Location location = PXSelect<

                        Location,

                        Where<Location.bAccountID, Equal<Required<Location.bAccountID>>,

                            And<Location.locationCD, Equal<Required<Location.locationCD>>>

                                                >>

                        .Select(Base, row.CustomerID, cadena);





                  ARSalesPrice salesprice = PXSelect<

                      ARSalesPrice,

                      Where<ARSalesPrice.custPriceClassID, Equal<Required<ARSalesPrice.custPriceClassID>>,

                          And<ARSalesPrice.inventoryID, Equal<Required<ARSalesPrice.inventoryID>>, 

                          And<ARSalesPriceExt.usrSubItemID, Equal<Required<ARSalesPriceExt.usrSubItemID>>,

                          And<ARSalesPrice.breakQty, LessEqual<Required<ARSalesPrice.breakQty>>

                                                            >

                                                          >

                                                       >

                                                    >,

                      OrderBy<

                          Desc<ARSalesPrice.breakQty>>

                                                >

                      .Select(Base, location.CPriceClassID, row.InventoryID, row.SubItemID, row.Qty);

    

                  if(salesprice == null)

                  {

                      ARSalesPrice salesprice2 = PXSelect<

                          ARSalesPrice,

                          Where<ARSalesPrice.custPriceClassID, Equal<Required<ARSalesPrice.custPriceClassID>>,

                              And<ARSalesPrice.inventoryID, Equal<Required<ARSalesPrice.inventoryID>>,

                              And<ARSalesPriceExt.usrSubItemID, Equal<Required<ARSalesPriceExt.usrSubItemID>>

                                                              >

                                                            >

                                                          >,

                          OrderBy<

                              Asc<ARSalesPrice.breakQty>>

                                                      >

                          .Select(Base, location.CPriceClassID, row.InventoryID, row.SubItemID);

                    

                      if (salesprice2 != null)

                      {

                          cache.SetValue<SOLine.curyUnitPrice>(row, salesprice2.SalesPrice);

                      }

                      else

                      {

                          row.CuryUnitPrice = (decimal?) 0.00;

                      }  

                  }

                  else

                  {

                      cache.SetValue<SOLine.curyUnitPrice>(row, salesprice.SalesPrice);

                  }

            }

        }

      

    }

      

    #endregion

  }

}

Best answer by Naveen Boga

Hi @alejandroalvarado64,

To skip the base logic code, you can write the code like below.

 protected virtual void SOLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)
        {
      //InvokeBaseHandler?.Invoke(cache, e);   -→ Comment this line, so that base code will NOT execute from extension graph
            SOLine row = e.Row as SOLine;
            if (row != null)
            {
                    // logic here

            }
       }

View original
Did this topic help you find an answer to your question?

2 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3407 replies
  • Answer
  • October 20, 2020

Hi @alejandroalvarado64,

To skip the base logic code, you can write the code like below.

 protected virtual void SOLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)
        {
      //InvokeBaseHandler?.Invoke(cache, e);   -→ Comment this line, so that base code will NOT execute from extension graph
            SOLine row = e.Row as SOLine;
            if (row != null)
            {
                    // logic here

            }
       }


Hi @naveenb74,

Thanks for your suggestion, I was able to implement that and worked fine.

Have a great day.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings