Skip to main content
Answer

WebDiaologResult is stuck

  • September 21, 2022
  • 1 reply
  • 120 views

Forum|alt.badge.img+1

When I reset dialog answer (PaymentCalendar.View.Answer = WebDialogResult.None) in the PaymentCalendar view, my function ,,dublicateItems" Called again and the loop is executed again. How to continue loop execution instead of calling a function?

My code
 public virtual void dublicateItemsOK()
        {
            foreach (DateTime dateTime in dateTimeList) {
                WebDialogResult result = PaymentCalendar.Ask(ActionsMessages.Warning,                   PXMessages.LocalizeFormatNoPrefix(textMessage), MessageButtons.YesNo, MessageIcon.Warning, true);
                 if (result != WebDialogResult.Yes) {
                 PaymentCalendar.View.Answer = WebDialogResult.None;
                 continue; }
              }
}

Best answer by Dmitrii Naumov

I don’t think there is a way to achieve that as the Ask method that creates a dialog is actually throwing an exception, thus interrupting the code flow. You may try to encapsulate the code inside the loop in a separate method, but I’m not sure if that’s going to help.

1 reply

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • Answer
  • September 21, 2022

I don’t think there is a way to achieve that as the Ask method that creates a dialog is actually throwing an exception, thus interrupting the code flow. You may try to encapsulate the code inside the loop in a separate method, but I’m not sure if that’s going to help.