Message Box that stops the action

It must be Monday!

I am blanking on the code that is needed to stop processing when a user selects a check box and a certain condition has not been met. Just the message box portion.

I have the below right now that runs on a beforefieldchange form event on Customer Shipment Entry. It does not stop the processing when a user selects the Shipped check box which is what I want to happen.

MessageBox.Show("A Pack cannot be shipped until the pack slip has been reconciled.");

You might try writing some logic that checks conditions before allowing Epicor to perform the action that you’re trying to block. In that case, you’d show a msg box and then return out of your checking method prior to allowing the transaction to proceed.
You could also consider throwing an exception, but sometimes that can get messy when dealing with transactions. Remember that a message box in and of itself is just a message to the user. It’s on you to deal with the logic behind when to show it.

Maybe I’m not remembering correctly, but I thought there was some code that threw an error message box. Similar to the message box in a BPM where you can select a severity level.

My brain is clearly still sleeping right now, so I would not be surprised if I am making all of this up.

You might be thinking of a try/catch statement wherein you “catch” the system thrown Exception and display the exception message to the user. In that case, the logic was already defined by the system however, meaning that the exception conditions were and the exception was thrown.

Finally figured it out. It’s

throw new Ice.BLException()

1 Like