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.
But by clicking OK. show this message
My code is:
Many thanks in advance!
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);
}