8. Notifications
In-app notifications appear in the platform's notification centre for the users you target.
Notify and NotifyGroup have no Async in their names while BroadcastAsync does. All three are asynchronous and all three must be awaited — the naming is a historical artefact, not a distinction.
Notify(userId, title, content, link, type)
async· returnsboolean
Sends a notification to one user.
Prop
Type
await context.functions.Notify(
String(context.claims.userId),
"Document approved",
"Your contract has been approved and is ready to sign.",
"/contracts/" + context.record.ID,
"success"
);Returns true when the notification was delivered, false when it was not. It does not throw on failure, so check the result if delivery matters.
Unlike the underlying service, this function declares no optional parameters. Pass null for link if there is nothing to link to, and always pass a type.
await context.functions.Notify(userId, "Import finished", "1,204 rows loaded.", null, "info");userId must be a string. Record IDs come back as numbers, so wrap them: String(context.record.AssignedTo.ID).
NotifyGroup(field, operator, value, title, content, link, type)
async· returnsboolean
Sends the same notification to every user matching a condition on their user record. One notification is delivered per matched user.
Prop
Type
await context.functions.NotifyGroup(
"RoleId", "equal", "1",
"System alert",
"A critical error occurred and needs attention.",
"/admin/errors",
"error"
);Returns true only when every recipient succeeded. A single failure among fifty makes the whole call return false, and there is no per-recipient breakdown — treat the result as "all delivered" or "something went wrong".
BroadcastAsync(title, content, link?, type?)
async· returnsboolean
Sends a notification to every user in the application.
Prop
Type
await context.functions.BroadcastAsync(
"Scheduled maintenance",
"The system will be unavailable on Sunday from 02:00 to 04:00.",
"/announcements/maintenance",
"warning"
);This is the one notification function with genuinely optional parameters — link and type may be omitted:
await context.functions.BroadcastAsync("Nightly sync complete", "All records are up to date.");