CRecordWebNotifyDialogDismissed

This message is a notification. It states that a web dialog has been ended.

The message is part of the Web Dialog API of RemoteSkin for Web. The API is part of the NY_RemoteSkinWebProtocolAPI plugin.

{
  "id": "93419a92-5055-4a1f-a35b-59a92467764b",
  "name": "WEB_NOTIFY_DIALOG_DISMISSED",
  "description": "The web dialog has been dismissed.",
  "slots": [
    {
      "key": "1",
      "name": "MICROSERVICE_ID",
      "direction": "REQUEST",
      "mandatory": "TRUE",
      "type": "ID",
      "description": "The micro service ID"
    },
    {
      "key": "2",
      "name": "REASON",
      "direction": "REQUEST",
      "mandatory": "TRUE",
      "type": "INT",
      "description": "0: successfully finished, 1: error, 2: canceled by user, 3: canceled by owner"
    },
    {
      "key": "3",
      "name": "RESULTS",
      "direction": "REQUEST",
      "mandatory": "FALSE",
      "type": "STRING_PROPERTIES",
      "description": "Optional: unspecified results."
    }
  ]
}

Usage

The message can be caught if you have created a dialog with the CRecordShowWebDialog message and the dialog has been closed.

// constructor:
addMessageHandler(CRecordWebNotifyDialogDismissed.ID,
                  this::asyncWebDialogFinished);
private boolean asyncWebDialogFinished(@NotNull final CEnvelope aEnvelope,
                                       @NotNull final CRecord aRecord) throws CException
{
    if (aEnvelope.isAnswer())
    {
        return false;
    }
    else
    {
        final int reason = CRecordWebNotifyDialogDismissed.getReason(aRecord,
                                                                     -1);
        if (reason == CWebDialogApi.REASON_SUCCESS)
        {
            final IId microserviceId = CRecordWebNotifyDialogDismissed.getMicroserviceId(aRecord,
                                                                                         null);
            // Check whether this is our dialog
            if (MICRO_SERVICE_YES_NO.equals(microserviceId))
            {
                // The returned properties contain the results as well as the properties provided.
                final CStringProperties results = CRecordWebNotifyDialogDismissed.getResults(aRecord,
                                                                                         new CStringProperties());
                final String yesOrNo = results.get("result");
                if ("yes".equals(yesOrNo))
                {
                    // ...
                }
            }
        }
        else if (reason == CWebDialogApi.REASON_ERROR)
        {
            // ...
        }
        else if (reason == CWebDialogApi.REASON_CANCELED_BY_USER)
        {
            // ...
        }
        else if (reason == CWebDialogApi.REASON_CANCELED_BY_OWNER)
        {
            // ...
        }
        aEnvelope.setResultSuccess();
        return true;
    }
}