Show Message

Summary

SigmaSDK.WRITER.showMessage() displays a modal dialog in the Zoho Writer interface. The dialog is blocking — the user must dismiss it before continuing. Optionally includes action buttons.

Purpose

  • Display success, error, info, or warning modal dialogs
  • Prompt the user for confirmation before an action
  • Show important messages that require acknowledgment
  • Provide action buttons that trigger extension functions

Syntax

SigmaSDK.WRITER.showMessage({
    type: "success" | "error" | "info" | "warning",
    title: "Dialog Title",
    message: "Message text",
    buttons: { "Label": "functionName()" }
})

Parameters

ParameterTypeRequiredDescription
typeStringYesMessage type: "success", "error", "info", or "warning"
titleStringYesDialog title text
messageStringYesDialog body message
buttonsObjectNoAction buttons as { "Label": "functionName()" }

Complete Example

<!DOCTYPE html>
<html>
<head>
    <title>Show Message Widget</title>
    <script src="https://static.zohocdn.com/sigma/client/sdk/v3/sigma-sdk.min.js"></script>
    <style>
        body { font-family: Arial, sans-serif; padding: 20px; }
        button { padding: 10px 20px; margin: 5px; cursor: pointer; }
    </style>
</head>
<body>
    <h1>Show Message Demo</h1>
    <button onclick="showSuccess()">Success</button>
    <button onclick="showError()">Error</button>
    <button onclick="showInfo()">Info</button>
    <button onclick="showWarning()">Warning</button>

    <script>
        SigmaSDK.WRITER.init();

        function showSuccess() {
            SigmaSDK.WRITER.showMessage({
                type: "success",
                title: "Success!",
                message: "The operation completed successfully."
            });
        }

        function showError() {
            SigmaSDK.WRITER.showMessage({
                type: "error",
                title: "Error",
                message: "Something went wrong. Please try again.",
                buttons: { "Retry": "showError()", "Cancel": "" }
            });
        }

        function showInfo() {
            SigmaSDK.WRITER.showMessage({
                type: "info",
                title: "Information",
                message: "Here is some useful information about this extension."
            });
        }

        function showWarning() {
            SigmaSDK.WRITER.showMessage({
                type: "warning",
                title: "Warning",
                message: "This action cannot be undone.",
                buttons: { "Proceed": "doAction()", "Cancel": "" }
            });
        }

        function doAction() {
            console.log("Action confirmed");
        }
    </script>
</body>
</html>

Buttons Object Format

buttons: {
    "Button Label": "functionName()",   // Calls the named function
    "Another Label": ""                 // Empty string = dismiss/close
}

Use Cases

  • Confirm before deleting or overwriting data
  • Display API error messages with a Retry option
  • Notify the user that a long operation is complete
  • Show important warnings before irreversible actions

Related Pages