If you need a proper pop-up dialog you’d need to call the ask() method on a view, but from I understand it’s frowned upon to do so from an event handler, they’re meant to be used within actions (however they do still work within event handlers). Although this is usually a little overkill if it’s just for throwing an error. You can learn more about smart panels/pop up dialogs here: https://asiablog.acumatica.com/2015/11/using-smart-panel.html
If you’re okay with a web browser pop up, you can simply use: throw new PXException("Your error message here”);
But those can be a little jarring in my opinion.
Alternatively if you just want to throw an error within acumatica, there are a handful of ways to go about that! So this wouldn’t give you a pop up, but it would put a little red mark on the fields you desire and it won’t let users save. You can hover over the red mark to see the error message.
A couple ways to do this would be to call the RaiseExceptionHandling method on a cache with a PXSetPropertyException, or the setError method from a PXUIFieldAttribute. These are the methods I use most often.
If you use that last method, you’ll probably want to reapply the error on row selected event handler as well, as otherwise I believe the error would disappear on the next user input.
Anyway, here’s an example of a similar need as yours, I’d try something like this first and see how that works for you first: https://stackoverflow.com/questions/61820502/what-is-the-best-way-to-raise-validation-exception-in-grid-cell-grid-row-form
You can also use the PopupNoteManager.RegisterText method to just register a pop up during an event handler. The Ask method is a bit problematic because it will recall the method with the response, that will cause issues in event handlers.