Skip to main content

Displaying Messages

Use the ShowMessage frontend command to display a notification to the user. Messages can indicate success, failure, a warning, or general information.

When your handler calls ShowMessage(), the command is queued and returned in the /runevent response. The SDK receives the response and displays the notification.


Command structure

{
"command": "ShowMessage",
"args": {
"type": "success",
"message": "Record saved successfully."
}
}

type values

ValueAppearance
successGreen — operation completed
errorRed — operation failed
warningYellow/orange — attention required
infoBlue — neutral information

C# implementation

// Success
ShowMessage("success", "Employee record saved.");

// Error
ShowMessage("error", "Failed to save record. Please try again.");

// Warning
ShowMessage("warning", "This action cannot be undone.");

// Info
ShowMessage("info", "Approval request sent to your manager.");

Common patterns

After saving a record

public async Task Form_onClick(string widgetName)
{
if (widgetName == "savebtn")
{
try
{
await SaveEmployee(record.GetData(), Context.Guid);
ShowMessage("success", "Employee saved successfully.");
CloseForm();
}
catch (Exception ex)
{
ShowMessage("error", $"Save failed: {ex.Message}");
}
}
}

Validation feedback

public async Task Form_onSave()
{
var errors = ValidateForm(record.GetData());

if (errors.Any())
{
string summary = string.Join(" | ", errors);
ShowMessage("warning", summary);
return;
}

await PersistRecord(record.GetData(), Context.Guid);
ShowMessage("success", "Saved.");
CloseForm();
}

Informational on load

public async Task Form_onInit(bool isInitialLoad)
{
if (!record.IsNewByRequest())
{
var dbRecord = await LoadRecord(record.GetRecordGuid());

if (dbRecord.Status == "Locked")
{
ShowMessage(
"info",
"This record is locked and cannot be edited.");
}
}
}

Multiple messages

You can queue multiple messages; they display sequentially:

ShowMessage("success", "File uploaded.");
ShowMessage("info", "Processing will complete in a few minutes.");