Skip to main content

Hi,

In my graph I’ve a custom button(Verify Vendor) and that button click event fire again press OK on the WebDialogResult popup comes up. 

Here is my screen shot and the click event.

public PXAction<HMRCVendorRegisterDetail> VerifyVendor;
rPXButton(CommitChanges = true)]
rPXUIField(DisplayName = "Verify Vendor", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Enabled = false)]
protected virtual IEnumerable verifyVendor(PXAdapter adapter)
{
    //Logics here
    
    if(VendorRegisterDetail.Current.BAccountID == null)
    {
        WebDialogResult result = VendorRegisterDetail.Ask(ActionsMessages.Warning, Messages.VendorEmptyMessage,
        MessageButtons.OK, MessageIcon.Warning, true);
    }
    
    return adapter.Get();
}

Can someone help me out to solve this issue?

Thanks

That’s the way it works. Every Ask method eventually throws a special exception that is being handled somewhere up the call stack. To return the execution to the same place, the framework “remembers” the method the exception has been thrown from and re-executes that method once the exception has been dealt with.

 

If your intention is to just show a warning, I’d recommend just putting the warning on a field using RaiseExceptionHandling method instead of using Ask.

 


@bhagyat25, Since you are using a custom Action, PXLongOperation would be a best option to validate and display the message.

PXLongOperation.StartOperation(this, delegate ()
{
if (VendorRegisterDetail.Current.BAccountID == null)
    {
    var message = "Your message here";
    throw new PXException(message);
    }
}); 

 


Reply