Skip to main content
Solved

Stumped on setting a warning when LineTotal (CuryLineTotal) is less than 50

  • January 15, 2022
  • 4 replies
  • 428 views
  • Translate All

Forum|alt.badge.img+1

I’m new to Acumatica and trying to get my head around adding what seems like a simple customisation.  I've been trying to get a warning to show when the line total is less than 50 on a Sales Order.  I have looked at other examples of how to raise a warning and tried various things but I’m not entirely sure what event handler it should go in as it’s not a user updatable field. I also think I should be using a different method to show the error but not sure what.

The following is what I have:

protected void SOOrder_CuryLineTotal_FieldVerifying(PXCache cache, PXFieldVerifyingEventArgs e, PXFieldVerifying InvokeBaseHandler)
{
if(InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (SOOrder)e.Row;

if (row == null) return;

if (row.CuryLineTotal < 50)
{
throw new PXSetPropertyException("The order total is below the Wholesale minimum of $50.", PXErrorLevel.Warning);
}

}

The error gets thrown as a message box on the screen before I even get to open the order that has a lower value for the Line Total. I just want it to show a warning exclamation mark next to the Line Total if it’s less than 50 once the Sales Order is displayed.

 

Sorry if this is a noob question.

Best answer by Naveen Boga

@ppowell  The right place to write a code related to warning messages is RowEelected event, instead field selecting or field updated.

View original

4 replies

Forum|alt.badge.img+1
  • Author
  • Semi-Pro II
  • January 16, 2022

After scouring the source code for PX.Objects.SO.SOOrderEntryExternalTax I found the right code now. 

For anyone else who runs into this:

PXUIFieldAttribute.SetWarning<SOOrder.curyLineTotal>(cache, e.Row, "The order total is below the Wholesale minimum of $50.");

I put it under FieldUpdated and FieldSelected event handlers.

Translate

Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • Answer
  • January 16, 2022

@ppowell  The right place to write a code related to warning messages is RowEelected event, instead field selecting or field updated.

Translate

Forum|alt.badge.img+1
  • Author
  • Semi-Pro II
  • January 16, 2022

@ppowell  The right place to write a code related to warning messages is RowEelected event, instead field selecting or field updated.

Thanks. Really appreciate the advice. I’ll change it to RowSelected then.

Translate

Naveen Boga
Captain II
Forum|alt.badge.img+20

Most Welcome @ppowell 

Translate