Skip to main content

Hello, on Purchase Receipt Release action, we need to show user a Confirmation Dialog, then based on the input from first Confirmation Dialog, we need to show another Confirmation Dialog popup. On release action first Confirmation Dialog appears but not the second one. Please have a look at below code and suggest me what wrong am doing here.

 

public virtual IEnumerable Release(PXAdapter adapter)
{

if (Base.Document.Ask("Confirmation Dialog 1", MessageButtons.YesNo)
                             != WebDialogResult.Yes) return adapter.Get();

else

if (Base.Document.Ask("Confirmation Dialog2", MessageButtons.YesNo)
                             != WebDialogResult.Yes) return adapter.Get();

}

Hi @ckwiat46 

We need to use different views to get 2 popup messages

For example

   if (Viewname1.View.Ask("Confirmation Dialog 1", MessageButtons.YesNo) == WebDialogResult.Yes)
            {               
                    if (Viewname2.View.Ask("Confirmation Dialog2", MessageButtons.YesNo) == WebDialogResult.Yes)
                    {
                        return adapter.Get();
                }
            }

In your example, you used the Base. Document view for both popup.  use another new/existing view for the second popup.


Just a bit more info on this, by default it uses the view as the key for the dialog result so when you use the same view it will return yes for both of those even if you only clicked the first dialog.

Apart from using a different view you can also provide your own key:

if (Base.Document.Ask("ConfirmationKey1", "Confirmation Header", "Confirmation Dialog 1", MessageButtons.YesNo) != WebDialogResult.Yes){
return adapter.Get();
}

if (Base.Document.Ask("ConfirmationKey2", "Confirmation Header", "Confirmation Dialog2", MessageButtons.YesNo) != WebDialogResult.Yes){
return adapter.Get();
}

 


Thanks @jinin this worked.


Great  @ckwiat46 .  Thanks for the confirmation  :slight_smile:


Reply