JavaScript examples: messages and redirects in the browser
Run Custom Code runs on Tadabase's servers, so it cannot show toasts or redirect. Use the Show Message action for messages, links and page reloads.
- Verified Nov 17, 2026
- Classic builder
On this page
Code in a Run Custom Code workflow action runs on Tadabase's servers, not in the user's browser. It cannot show a toast, open a pop-up, redirect the user, copy to the clipboard, download a file or play a sound. To do those, let the code work out what should happen, and show it with the Show Message action.
About older examples #
Older examples called helpers such as userNotify(), userAlert(), showModal(), redirectTo(), copyToClipboard(), downloadFile() or playSound() from the code. Nothing those calls do reaches the user's screen. Remove them and use the steps below.
Show a result to the user #
- Work it out in code In the Run Custom Code step, return what the user should see, for example
returnData("ok", false)andreturnData("reason", "too_low"). - Branch on the result Add a condition on the code step's Action Response Value, for example
okis false. See Conditions and branches. - Add a Show Message step In each branch, add Show Message, choose how it looks and write the text the user should read.
// Input: amount (Record Value (Source))
const amount = Number($amount) || 0;
if (amount <= 0) {
returnData("ok", false);
returnData("reason", "too_low");
return;
}
returnData("ok", true);
returnData("amount_text", amount.toFixed(2)); What Show Message can do #
| You want to | In Show Message |
|---|---|
| Show a short notice | A Toast (small card in the corner) or a Banner (strip across the top). |
| Show a window | A Dialog, or Blocking when the user must click one of its buttons to close it. |
| Send the user to another page | A button with the action Go to a page. |
| Open a web address | A button with the action Open a link. |
| Reload or refresh | A button with Reload the page or Refresh table components. |
| Copy text for the user | A button with the action Copy text. |
A message can have up to three buttons. You also choose who sees it, such as Person who started it or Users with roles, and its tone: Success, Info, Warning, Error or Neutral.
When you need code in the browser #
JavaScript that must run in the user's browser, such as listening for clicks or changing how a page looks, belongs on the page, not in a workflow. See Add CSS and JavaScript to a page or layout.
Was this page helpful?
Something wrong or missing on this page? Tell us.