Skip to main content
Solved

Need help in Confirmation Dialog

  • January 19, 2022
  • 4 replies
  • 455 views

Forum|alt.badge.img

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

}

Best answer by jinin

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.

View original
Did this topic help you find an answer to your question?

4 replies

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 699 replies
  • Answer
  • January 19, 2022

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.


Forum|alt.badge.img+5
  • Jr Varsity II
  • 237 replies
  • January 19, 2022

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

 


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 44 replies
  • January 21, 2022

Thanks @jinin this worked.


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 699 replies
  • January 21, 2022

Great  @ckwiat46 .  Thanks for the confirmation  :slight_smile:


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings