0

I need to show a message when I click on the process button. If the selected amount is greater than 700 and if it is lower, do not show a message.

image01

But by clicking OK. show this message

image02

My code is:

image03 image04

Many thanks in advance!

Marco A.
  • 27
  • 5

1 Answers1

0

Avoid showing dialog in the RowSelected method. That method is called every time a record is fetched so it will display it in an uncontrollable loop.

Also check the return value of the dialog to know which button was pressed.

To show the dialog when the Process button is pressed, override the Process method. You might have to change 'Base' depending on the context (PXGraph/PXGraphExtension):

[PXProcessButton]
[PXUIField(DisplayName = "Process", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
protected override IEnumerable Process(PXAdapter adapter)
{
    if (Base.Ask("ConfirmationTitle", "ConfirmationMessage", MessageButtons.YesNo) != WebDialogResult.Yes)
    {
        // Click on No, don't execute the base Process action
        return adapter.Get();
    }

    // Click on Yes, execute the base Process action
    return Base.Process(adapter);               
}
Hugues Beauséjour
  • 8,067
  • 1
  • 9
  • 22