Solved

How to stop adding new SOLines in Sales Orders Screen according to a condition

  • 9 January 2023
  • 2 replies
  • 52 views

Userlevel 4
Badge +1

Hi All,

 

I want to stop adding new lines to a sales order based on a condition. How can I do this.?

I tried adding the following. But It did not worked.

  protected void SOLine_RowInserting(PXCache cache, PXRowInsertingEventArgs e)
  {

            var row = (SOLine)e.Row;

            if (row == null) return;

            //Condition

            if(Condition == true)

           {

                       Base.Transaction.Delete(row);

            }

 

  }

 

icon

Best answer by aaghaei 9 January 2023, 21:31

View original

2 replies

Userlevel 7
Badge +8

@charithalakshan49

Where this condition(s) are coming from? From header (SOOrder) or from line (SOLine) values itself?

If you want to prevent from insert based on header values the easiest option is 

{

    Base.Transaction.Cache.AllowInsert = false;

}

if you are playing with lines itself then you can use 

{

    e.Cancel = true;

    return;

}

 

Userlevel 4
Badge +1

@aaghaei yes, I was playing with lines itself & It worked.! Thank you so much.

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