Skip to main content
Question

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


Forum|alt.badge.img+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

Fernando Amadoz
Jr Varsity I
Forum|alt.badge.img+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.

 

 


Forum|alt.badge.img+1
  • Author
  • Semi-Pro I
  • 134 replies
  • August 1, 2022

@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


Fernando Amadoz
Jr Varsity I
Forum|alt.badge.img+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


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