Callback functions
A SQL block can tell the app what to do next instead of just returning a value. Return a result set
whose first column is named FunctionName; each row is one callback, and the other columns are its
parameters in column order.
SELECT 'showAlert' FunctionName, 'success', 'Created', 'Plan created. Use Generate, upload rows or add lines manually.';This works from any write-side <Sql>: a form’s insert/update, a delete, a row or toolbar
action, an import AfterSql, and RPC blocks.
How a callback row is read
Section titled “How a callback row is read”- Name. The first column must be called
FunctionName(any case). Its value must match^[A-Za-z_][A-Za-z0-9_]*$. - Parameters are positional. The 2nd column is
Param1, the 3rdParam2, and so on. Column names after the first don’t matter. SQLNULLarrives asnull. - Rows run in order, one at a time. Each callback finishes (e.g. the user closes the dialog) before
the next row runs. Chain several with
UNION ALLor by selecting more than one row. - Every row in a
UNION ALLneeds the same column count. Pad shorter callbacks withNULL. - An unknown name stops the chain and shows an Unknown action dialog, so a typo is visible.
Two kinds of callback
Section titled “Two kinds of callback”| Kind | Runs in | Names |
|---|---|---|
| UI callbacks | the browser, through a closed registry (no eval, no inline JS) |
refreshTable, showAlert, showSuccess, showError, swal, closeModal, navigate, historyBack, openWindow |
| Server callbacks | the engine, inside the same request | startWorkflow, transitionWorkflow, transitionEntityWorkflow, workflowSubmitApproval |
The engine runs server callbacks itself and removes them from the response, so the browser never sees them and there is no public endpoint for them. One result set can mix both kinds:
SELECT 'startWorkflow' FunctionName, 'OrderApproval', 'Orders', @Id -- runs on the serverUNION ALLSELECT 'showSuccess', 'Submitted', 'Sent for approval.', NULL; -- runs in the browserUI callbacks
Section titled “UI callbacks”FunctionName |
Params | Effect |
|---|---|---|
refreshTable |
— | Reload the surrounding grid or record. |
showAlert |
severity, title, message | Dialog. Severity: success, error, info, warning or question (anything else shows as info). |
showSuccess |
title, message | Success dialog. |
showError |
title, message | Error dialog. |
swal |
title, message, severity | Legacy alias for showAlert, with the old parameter order. Severity defaults to error. |
closeModal |
— | Close the surrounding modal. |
navigate |
url | Go to a URL. Internal paths (/object/orders?id=5) navigate in the app; absolute URLs do a full page load. javascript: URLs are refused. |
historyBack |
— | Browser back. |
openWindow |
url, target, features | window.open. Target defaults to _blank, features to noopener,noreferrer. javascript: URLs are refused. |
Examples
Section titled “Examples”-- Validation message that keeps the form open so the user can fix it:IF @EndDate < @StartDateBEGIN SELECT 'showAlert' FunctionName, 'error', 'Invalid dates', 'End date must be after the start date.'; RETURN;END
-- Save, confirm, and go to the new record:INSERT INTO [Planning].[Plans] (Name) VALUES (@Name);DECLARE @NewId BIGINT = CAST(SCOPE_IDENTITY() AS BIGINT);SELECT 'showSuccess' FunctionName, 'Created', 'Plan created.', NULLUNION ALLSELECT 'navigate', CONCAT('/object/plans?id=', @NewId), NULL, NULL;
-- Row action that only needs the grid reloaded:UPDATE [Sales].[Orders] SET Status = 'Approved' WHERE Id = @Id;SELECT 'refreshTable' FunctionName;
-- Open a generated document in a new tab:SELECT 'openWindow' FunctionName, CONCAT('/api/v1/report/invoice?id=', @Id), '_blank', NULL;What happens after the callbacks
Section titled “What happens after the callbacks”After the callbacks run, a form or row action decides whether to do its default follow-up: a form returns to where it came from or closes its modal, and a row action reloads the grid. It does this only when every row was a harmless follow-up:
refreshTable,closeModalorshowSuccess, orshowAlert/swalwith severitysuccess.
Any other row keeps the screen where it is. That includes an error or warning alert, a navigate,
or an openWindow. So an error alert leaves the form open for correction, and navigate decides where
the user goes. You don’t need to add refreshTable after a success message; the grid reloads once
either way.
Server callbacks
Section titled “Server callbacks”These start or move a workflow from the same SQL that saved the record. Signatures, in brief:
FunctionName |
Params |
|---|---|
startWorkflow |
WorkflowName, EntityType, EntityId [, …context columns] |
transitionWorkflow |
InstanceId, TransitionLabel [, Comment] [, …context columns] |
transitionEntityWorkflow |
EntityType, EntityId, TransitionLabel [, Comment] [, …context columns] |
workflowSubmitApproval |
InstanceId, NodeKey, Decision, Comment |
UPDATE [Inventory].[PurchaseOrders] SET Status = @Status WHERE Id = @Id;SELECT 'transitionEntityWorkflow' FunctionName, 'PurchaseOrders', @Id, 'Resubmitted', @Comment;Full rules, context columns and batch starts are in Workflow callbacks.
Adding your own callback
Section titled “Adding your own callback”The UI registry is closed: a host app cannot register a new FunctionName. This is deliberate. A
callback name comes from SQL data, so an open registry would let any value in a result set call host
code. To change how the app looks or behaves from a project, use the host extension points instead:
Custom UI functions covers expression functions, cell renderers and
cell classes.
Copyright © 2026 Orbyn Technologies. All rights reserved.