Skip to Content
0
Sep 30, 2020 at 09:45 AM

How to get the answer from pop-up message straight after the user action

95 Views

Hi all

I'm trying to get an answer from the user in real-time. I need to learn the answer to a message/pop-up when it's is clicked so the script will know the answer and behave as I coded it to behave. Below, is the code I'm using to try to achieve that, but the script will only stop on the debug in the function when the entire script is run and I need to know the answer straight after the session.utils.showOptionDialog.

Does anyone knows how can I achieve this?

 session.utils.showOptionDialog(
        "Bank not found",
        _RETURN.MESSAGE,
        session.utils.MESSAGE_TYPE_QUESTION,
        session.utils.MESSAGE_OPTION_YESNO,
        onOptionDialogClose,
        "BankNotFound"
      );

// --> I need to get the answer here

if (bank_iban_text != _E_IBAN && answer = "Yes") {
      bank_iban_text = _E_IBAN;
    }

After the code, there is the function script

function onOptionDialogClose(decision, ID) {
	debugger;
  if (ID === "BankNotFound") {
    if (decision === 2) {
      createBank = "Yes";
      //session.utils.put("CreateBank", "Yes");
    }
    if (decision === 3) {
      createBank = "No";
      session.utils.put("CreateBank", "No");
    }
  }
}

Thanks

Andrea