Commands
Commands are returned in your /runevent response and executed by the SDK after each event. Your handler queues them by calling the corresponding helper methods — the SDK processes them in order.
At their core, commands are just JSON keys in the response body. The helper methods (cmd.*, screen.*) are convenience wrappers that build that JSON for you — but you can implement your own wrappers in any language as long as the response structure matches what the SDK expects.
All commands listed here are already implemented in the Workforce Management example on GitHub. Use it as a working reference, or copy the wrapper classes directly into your project.
Commands overview
| Command | Method | Description |
|---|---|---|
OpenModal | cmd.ShowRecord() | Open a form in a modal |
Messages | cmd.SuccessMessage() / cmd.NotificationMessage() / cmd.WarningMessage() | Display a notification |
Download | cmd.Download() | Trigger a file download |
PreviewDocument | cmd.PreviewDocument() | Open the document viewer |
CloseForm | cmd.CloseForm() | Close the current form |
Redirect | cmd.RedirectToUrl() | Navigate to a URL |
RedrawScreen | cmd.RedrawScreen() | Refresh the current form |
AfterRecordSave | cmd.SetAfterRecordSave() | Signal save completion and update the active GUID |
FormValidationData | cmd.SetFormValidationData() | Highlight invalid fields in red |
MoveToTab | screen.MoveToTab() | Switch to a specific tab |
widgetsState | screen.SetVisibility() / screen.SetReadonly() | Show/hide or lock widgets |
fieldAllowedValues | cmd.PopulateSelectBoxList() | Populate a select box |
OpenModal
Opens a form for viewing or editing a record in a modal window.
cmd.ShowRecord("INTRA", "CUSTOMERFORM", "new");
// With prefill data
cmd.ShowRecord("INTRA", "CUSTOMERFORM", "new", false, new Dictionary<string, object>
{
{ "status", "New" },
{ "country", "US" }
});
See Opening a Form in a Modal for the full parameter reference.
Messages
Display a notification to the user.
cmd.SuccessMessage("Record saved successfully.");
cmd.NotificationMessage("Processing will complete in a few minutes.");
cmd.WarningMessage("Approval limit exceeded.");
WarningMessage throws a UserWarningException internally — the SDK catches it and displays the warning to the user.
See Displaying Messages for more patterns.
Download
Triggers a file download in the browser.
cmd.Download("employee-export.xlsx", fileStoragePath);
See File Download for more patterns.
PreviewDocument
Opens the built-in document viewer with the given file.
byte[] pdfBytes = await _pdfService.RenderAsync("Template", record.GetData());
cmd.PreviewDocument("document.pdf", pdfBytes);
See Document Previewer for the full signature and patterns.
CloseForm
Closes the currently open form.
cmd.CloseForm();
Redirect
Navigates the user to a URL.
cmd.RedirectToUrl("/forms/customers");
cmd.RedirectToUrl($"/orders/{id}");
See Redirection for more patterns.
RedrawScreen
Refreshes the current form, re-firing its initialization events.
cmd.RedrawScreen();
AfterRecordSave
Signals that a new record was saved, updates the active GUID, and closes the modal if open.
cmd.SetAfterRecordSave(newId.ToString());
See Saving a Record for context.
FormValidationData
Highlights invalid fields in red and blocks further save attempts until they are filled.
Dictionary<string, string> errors = await formValidator.Validate(record, screen);
cmd.SetFormValidationData(errors);
See Form Validation for the full validation pattern.
MoveToTab
Programmatically switches the form to a specific tab widget.
screen.MoveToTab("detailstab");
widgetsState
Controls widget visibility and read-only state.
screen.SetVisibility("internalNotes", false);
screen.SetReadonly("createdAt", true);
See Hiding / Showing Widgets for more patterns.
fieldAllowedValues
Populates a select box with options.
cmd.PopulateSelectBoxList("status", new Dictionary<string, string>
{
{ "draft", "Draft" },
{ "active", "Active" }
});
See Populating Select Boxes for more patterns.
Chaining commands
Commands execute in the order they are queued:
cmd.SetFormValidationData(errors);
// or, on success:
cmd.SuccessMessage("Employee saved.");
cmd.SetAfterRecordSave(newId.ToString());