Solved

Need help in Confirmation Dialog

  • 19 January 2022
  • 4 replies
  • 345 views

Userlevel 2
Badge

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();

}

icon

Best answer by jinin 19 January 2022, 17:33

View original

4 replies

Userlevel 7
Badge +11

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.

Userlevel 6
Badge +5

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();
}

 

Userlevel 2
Badge

Thanks @jinin this worked.

Userlevel 7
Badge +11

Great  @ckwiat46 .  Thanks for the confirmation  :slight_smile:

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved