Question

Is there way to show a MessageBox when opening a Sales Order that has a certain ShipVia?


Userlevel 5
Badge +1

We would like to have a popup message when a sales order is opened that has a Drop Ship ShipVia (called DSFEDEX and DSUSPS).  This seems like it should be really simple to set up but I have failed so far to achieve my goal. I put the following in the SOOrder RowSelected event handler but it gives an error and fires repeatedly after trying to save the record with a DS ShipVia so I guess that is the wrong place or I need a way to check whether the record is saving and skip the messagebox somehow.

if (row.ShipVia == "DSFEDEX" || row.ShipVia == "DSUSPS") {
PXTrace.WriteInformation("This is a drop ship order!");
Base.Document.Ask("This is a DROP SHIP Order.", MessageButtons.OK);
}

 

Has anybody done something similar or have an idea about how to do such a thing?

Thanks,

Phil 


3 replies

Userlevel 5
Badge +2

@ppowell 

You can try using the popup notes. Here is a great article showing how you could implement it in your logic.

As for the events, RowSelected is run multiple times. It is not recommended to add the logic there.
Try to implement it in the OrderNbr’s FieldSelecting event (or in the DropShip field) as it is an event associated to data Display - as shown in the image below - and AFAIK it’s only run once per field.

 

 

Userlevel 5
Badge +1

@Fernando Amadoz Thanks for the advice.  Unfortunately it seems that the field selecting event runs multiple times also. Getting a message to pop up is no problem, I’m getting multiple of them.  The problem I have is finding an event that will only pop it up once or a mechanism to determine if it already showed the message before so I can suppress it in that case.

Phil

Userlevel 5
Badge +2

@ppowell 

Try the following:

  • Extend the SOOrder DAC and add an unbounded field to be used as a bool flag (false by default).
  • Only pop up the message if the value is false or NULL. And set it to true, the first time that the event is entered.
    This would allow - in theory - to trigger the message the first time only.

In other words, use the unbounded field as a sort of global variable.

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